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 |
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 |
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 |
All times are GMT +1. The time now is 11:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com