Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Running a macro from windows application
I need to run an Excel macro that is contained in the "ThisWorkbook" Module
of the file from a windows application. Can this be done. If so ...please help me out with the code. I tried OBJExcelWorkbook.Application.Run("MyMacro",missing ,missing......) but it says macro cant be found. I think this is because it is inside "ThisWorkbook". Please help. Thanks |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Running a macro from windows application
This is how I would do it in VBA (from within excel and from within the same
project): 'inside the ThisWorkbook module 'notice the Public keyword Option Explicit Public Sub myMacro(str1 As String, str2 As String) MsgBox str1 & vbLf & str2 End Sub And from a General module: Option Explicit Sub testme() Application.Run "thisworkbook.mymacro", "asdf", "qwer" End Sub ===== Actually, I would try to put any subroutine that isn't a workbook event in a general module (well, most the time). Aerojade wrote: I need to run an Excel macro that is contained in the "ThisWorkbook" Module of the file from a windows application. Can this be done. If so ...please help me out with the code. I tried OBJExcelWorkbook.Application.Run("MyMacro",missing ,missing......) but it says macro cant be found. I think this is because it is inside "ThisWorkbook". Please help. Thanks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
can i record a macro from excel to invvoke another windows application | Excel Discussion (Misc queries) | |||
Please free the Application Windows in Office 2007 | Excel Discussion (Misc queries) | |||
Windows application error message | Excel Discussion (Misc queries) | |||
separate application windows | Excel Discussion (Misc queries) | |||
How to keep userform always on the top of all windows application | Excel Discussion (Misc queries) |