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

Run Excel Macro From Access 2003

P: 2
Hey,

I routinely import an Excel file, operate on several columns and export it as a separate file. I need to be able to run an Excel Macro from my Access VBA.

Any Suggestions?/

Thanks much,
John O.
May 7 '07 #1
Share this Question
Share on Google+
1 Reply


JConsulting
Expert 100+
P: 603
Hey,

I routinely import an Excel file, operate on several columns and export it as a separate file. I need to be able to run an Excel Macro from my Access VBA.

Any Suggestions?/

Thanks much,
John O.
how about this?

Function RunExeclMacro(sFile As String, sMacro As String) As String
Dim xlApp As Object
Dim xlWb As Object
Dim xlWS As Worksheet
Dim strSheet As String
Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.Workbooks.Open(sFile, True)
xlWb.Run sMacro
xlWb.Close (True) '<saves it
xlApp.Quit
End Function
May 7 '07 #2

Post your reply

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