Running Excel Macro from Access

Mike-El Paso

New Member
Joined
Dec 27, 2002
Messages
3
I need help on running an Excel from within Access. I am able to open Excel from Access using RunApp but not able to run the Macro I need to further automate my procedure. Any help would be greatly appreciated.

Thanks
Mike
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I don't know if this is what you are doing but when I have run macros from Excel to Word. I create 2 macros one for Excel and the other for Word, when the macro opens Word I then "call" the Word macro.

Does this help you?
 
Upvote 0
Hi,

If you put the Excel macro in your Workbook_Open() event, it should automatically execute when the spreadsheet is opened.
In order to run Excel VBA from within Access(different from what I put above), you need to call the Excel library as the first procedure in your Access macro, like:<pre>Sub ExcelMacro()
Call MakeLibrary_Excel
Excel code
Excel code
Excel code
End Sub</pre>

I don't know the exact code for this, but it will probably look something like:<pre>Sub MakeLibrary_Excel()

On Error Resume Next

ThisWorkbook.VBProject.References.AddFromGuid _
"{00020905-0000-0000-C000-000000000046}", 8, 0

End Sub</pre>

The above reference is used to execute Word VBA from within Excel. I'd be very interested to see the equivelent code for executing Excel VBA from within Access, though I don't think its necessary for your situation.

HTH,
Corticus
This message was edited by Corticus on 2002-12-31 12:15
 
Upvote 0

Forum statistics

Threads
1,221,497
Messages
6,160,152
Members
451,625
Latest member
sukhman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top