Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open & run a workbook macro.
I have a source wb, with the following code in a code module:
Dim vPath As String Dim vWBOpenDataFileName As String Sub OpenDataFile() vPath = ActiveWorkbook.Path vWBOpenDataFileName = "DJ Sales Data Import macro for Judith.xls" Workbooks.Open vPath & "\" & vWBOpenDataFileName Debug.Print Application.Run("[" & vWBOpenDataFileName & "]!OpenDJSalesData") Stop End Sub It should open another wb called "DJ Sales Data Import macro for Judith.xls", and run the macro "OpenDJSalesData". But I get the error "Runtime error 1004: A document with the name "DJ Sales Data Import macro for Judith.xls" is already open. You can not open two documents with the same name, even if they are in different folders........". This error occurrs on the Debug.Print line. Why is this happening? WinXP SP1, XL2002. -- Julian Milano |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Open Workbook Macro??? | Excel Discussion (Misc queries) | |||
Run a macro when I open a workbook | Excel Discussion (Misc queries) | |||
run macro on workbook open | Excel Discussion (Misc queries) | |||
how can I run a macro when I open a workbook? | Excel Discussion (Misc queries) | |||
How to run VBA macro when the workbook is open? | Excel Programming |