Launch Excel vba macro from Access?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top