Launch Excel vba macro from Access?

R

Rob Stewart

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
 
S

Sean McPoland

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
 
Top