By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,573 Members | 907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,573 IT Pros & Developers. It's quick & easy.

Run Excel Macro from Access

P: 3
I have a need to run an Excel Macro from inside Access. Is this possible with Access 2003 to Excel 2003?
May 5 '07 #1
Share this Question
Share on Google+
1 Reply


JConsulting
Expert 100+
P: 603
I have a need to run an Excel Macro from inside Access. Is this possible with Access 2003 to Excel 2003?
Expand|Select|Wrap|Line Numbers
  1. Function RunExeclMacro(sFile As String, sMacro As String) As String
  2.     Dim xlApp As Object
  3.     Dim xlWb As Object
  4.     Dim xlWS As Worksheet
  5.     Dim strSheet As String
  6.     Set xlApp = CreateObject("Excel.Application")
  7.     Set xlWb = xlApp.Workbooks.Open(sFile, True)
  8.     wlwb.Run sMacro
  9.     xlWb.Close (True) '<saves it
  10.     xlApp.Quit
  11. End Function
  12.  
May 5 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.