Executing Excel-VBA code within a Access-database 
Author Message
 Executing Excel-VBA code within a Access-database

Hello,

I'm stuck with a problem with one of the databases i'm building, so i'm
hoping someone is able to help me...

Within my database (Acc. 2000) i've got a query containing a great ammount
of data (over 10.000 records). This data must be exported to a Excel file.
Within this Excel file I want the data to be subtotalized (and change some
fonts/colors columns widhts etc.). Now I've created the VBA macro code which
does the action in Excel, but what I really want is to run this Excell-VBA
code from Access. So after I pressed the export-button in my database, and
i'm opening the Excel file I don't have to copy and paste the VBA code.

If anyone has any suggestions, they would be appreciated.

Thanx,

Remco Groot Beumer
Holland



Thu, 22 Jul 2004 01:18:36 GMT  
 Executing Excel-VBA code within a Access-database
Once you've got your recordset, simply instantiate an Excel Application
Object using VBA in Access.  This will fire up a copy of excel from within
MS Access.  You can then use the Excel Object's method's and properties to
manipulate the data and the spreadsheet in any manner you see fit.  You need
not ever fire up Excel except to view your results.  We do this all the time
at work from other VBA enabled applications.  Since everyone has Excel, it
is easy for them to open up the output of certain applications.



Quote:
> Hello,

> I'm stuck with a problem with one of the databases i'm building, so i'm
> hoping someone is able to help me...

> Within my database (Acc. 2000) i've got a query containing a great ammount
> of data (over 10.000 records). This data must be exported to a Excel file.
> Within this Excel file I want the data to be subtotalized (and change some
> fonts/colors columns widhts etc.). Now I've created the VBA macro code
which
> does the action in Excel, but what I really want is to run this Excell-VBA
> code from Access. So after I pressed the export-button in my database, and
> i'm opening the Excel file I don't have to copy and paste the VBA code.

> If anyone has any suggestions, they would be appreciated.

> Thanx,

> Remco Groot Beumer
> Holland



Thu, 22 Jul 2004 03:40:43 GMT  
 Executing Excel-VBA code within a Access-database
For an example of what DanO's talking about, check out
http://www.mvps.org/access/modules/mdl0007.htm at Dev Ashish's "The Access
Web"

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele


Quote:
> Once you've got your recordset, simply instantiate an Excel Application
> Object using VBA in Access.  This will fire up a copy of excel from within
> MS Access.  You can then use the Excel Object's method's and properties to
> manipulate the data and the spreadsheet in any manner you see fit.  You
need
> not ever fire up Excel except to view your results.  We do this all the
time
> at work from other VBA enabled applications.  Since everyone has Excel, it
> is easy for them to open up the output of certain applications.



> > Hello,

> > I'm stuck with a problem with one of the databases i'm building, so i'm
> > hoping someone is able to help me...

> > Within my database (Acc. 2000) i've got a query containing a great
ammount
> > of data (over 10.000 records). This data must be exported to a Excel
file.
> > Within this Excel file I want the data to be subtotalized (and change
some
> > fonts/colors columns widhts etc.). Now I've created the VBA macro code
> which
> > does the action in Excel, but what I really want is to run this
Excell-VBA
> > code from Access. So after I pressed the export-button in my database,
and
> > i'm opening the Excel file I don't have to copy and paste the VBA code.

> > If anyone has any suggestions, they would be appreciated.

> > Thanx,

> > Remco Groot Beumer
> > Holland



Thu, 22 Jul 2004 05:50:39 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Vba code which can execute FTP script from within the Access 97 module

2. Calling Excel code within Access code?

3. Executing Access Query within VB Code

4. How to use Access MDB within Excel (OleObject / VBA)

5. Open excel spreadsheet from within Access using VBA

6. One workstation cannot open or execute VBA code in Access 97

7. How to open another database from within Access using code

8. Open different database file within Access using code

9. Running excel add-in (added into excel - not access) in Access VBA

10. vba code to copy table from access 97 to excel 97

11. VBA code to access PasteSpecial -> Excel Worksheet

 

 
Powered by phpBB® Forum Software