PC Review


Reply
Thread Tools Rate Thread

Access Macro to export table to Excel then run Excel macro

 
 
Craig
Guest
Posts: n/a
 
      13th Mar 2009
Hi

I want my user to just click a button to run an Access macro that exports a
table from the same Access database to an Excel spreadsheet and then have an
Excel macro that I developed run on that exported table....is all this
possible?

Thank you for any assistance!

Craig
 
Reply With Quote
 
 
 
 
Ken Snell MVP
Guest
Posts: n/a
 
      14th Mar 2009
You can do the export via a macro (using TransferSpreadsheet action), but
I'm not aware of any way to run an EXCEL macro from an ACCESS macro. To run
the EXCEL macro, you'll need to use VBA code in EXCEL. Here is sample code
for how to run an EXCEL macro from ACCESS:

Dim xls As Object, xwkb As Object
Dim strFile As String, strMacro As String
strFile = "ExcelFilename.xls"
strMacro = "MacroName"
Set xls= CreateObject("Excel.Application")
xls.Visible = True
Set xwkb = xls.Workbooks.Open("C:\" & strFile)
xls.Run strFile & "!" & strMacro
xwkb.Close False
Set xwkb = Nothing
xls.Quit
Set xls = Nothing

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


"Craig" <(E-Mail Removed)> wrote in message
news:9C0C555A-B9B8-4ED2-8FD9-(E-Mail Removed)...
> Hi
>
> I want my user to just click a button to run an Access macro that exports
> a
> table from the same Access database to an Excel spreadsheet and then have
> an
> Excel macro that I developed run on that exported table....is all this
> possible?
>
> Thank you for any assistance!
>
> Craig



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export Access table to excel using macro mcp201 Microsoft Access 1 29th Aug 2008 03:29 PM
Access macro to export to excel kimbobo Microsoft Access Macros 3 25th Aug 2006 08:55 AM
Use a macro to export a table to Excel =?Utf-8?B?U2FtQg==?= Microsoft Access Macros 1 5th May 2006 08:53 AM
How do I Append excel data to a Access database table in a excel macro? Pete Microsoft Excel Programming 1 2nd Nov 2005 06:40 PM
Export Access query to Excel via Macro Jules Hoppenbrouwers Microsoft Access Getting Started 1 21st Aug 2003 10:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:42 PM.