Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Launch Excel vba macro from Access?

Can anyone provide a simple way to call a piece of VBA code in an Excel
spreadsheet, from within VBA in an Access project?

I have a rather long winded approach of opening the spreadsheet via a
command shell in Access, and passing in command line parameters that then
trigger code in the auto_open() code...but I'm hoping for something a bit
simpler?!

Cheers,
Rob
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Launch Excel vba macro from Access?

This is how I do it from powerpoint - should work in
Access as well.

regards
Sean



Sub Main()

Dim appXL As Excel.Application
Set appXL = New Excel.Application
appXL.Visible = True

appXL.Workbooks.Open "D:\???\xxx\fn.xls"
appXL.Run ("sDriver") ' run the excel macro

appXL.ActiveWorkbook.Save
appXL.Quit

ActivePresentation.Save
Application.Quit

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Launch Excel vba macro from Access?

Perfect!

Thanks Sean.

"Sean McPoland" wrote:

This is how I do it from powerpoint - should work in
Access as well.

regards
Sean



Sub Main()

Dim appXL As Excel.Application
Set appXL = New Excel.Application
appXL.Visible = True

appXL.Workbooks.Open "D:\???\xxx\fn.xls"
appXL.Run ("sDriver") ' run the excel macro

appXL.ActiveWorkbook.Save
appXL.Quit

ActivePresentation.Save
Application.Quit

End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Launch of Macro Daren Excel Discussion (Misc queries) 1 March 20th 07 08:10 PM
launch any file type from excel macro arron laing Excel Programming 4 July 23rd 04 08:23 AM
How do I Launch a Macro on a different sheet Pepe[_2_] Excel Programming 1 January 19th 04 03:15 PM
Can you use an IF statement to launch a macro? ian123[_34_] Excel Programming 3 January 3rd 04 12:38 AM
Launch Macro in Access via Macro running in Excel??? dgrant Excel Programming 1 September 24th 03 01:38 PM


All times are GMT +1. The time now is 04:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"