LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Workbook Macro??? Supe Excel Discussion (Misc queries) 2 December 19th 07 08:37 PM
Run a macro when I open a workbook CraigJ Excel Discussion (Misc queries) 1 June 13th 07 04:04 PM
run macro on workbook open kevin Excel Discussion (Misc queries) 3 March 4th 05 10:12 AM
how can I run a macro when I open a workbook? filo666 Excel Discussion (Misc queries) 2 March 2nd 05 07:56 PM
How to run VBA macro when the workbook is open? Ji Wenke Excel Programming 1 July 9th 03 03:22 AM


All times are GMT +1. The time now is 11:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"