Article ID: 165518
Article Last Modified on 1/19/2007
Sub RunExcelMacroWithOLE()
Dim oXL As Object
Set oXL = CreateObject("Excel.Application")
' Open the workbook that contains the macro to run.
oXL.Workbooks.Open FileName:="C:\My Documents\Book1.xls"
' Run the macro.
oXL.Application.Run "Book1.xls!ThisWorkBook.MyExcelMacro"
' Quit Microsoft Excel.
oXL.Quit
' Free the object from memory.
Set oXL = Nothing
End Sub
When you use the Visual Basic for Applications sample macro for your own
purposes, substitute the appropriate workbook path, file name, module, and
macro name that you want to run.
Additional query words: wordcon word8 word97 8.00 8.0 vb vbe vba xlvbainfo
Keywords: kbhowto kbinterop kbprogramming KB165518