Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Open WorkBook & Run Macro

From code in one workbook I want to open another workbook and run a
procedure that is in it. I have this in the first workbook:
Sub RunTracking()
Dim cdir As String
Dim wb As Workbook

For Each wb In Workbooks
If wb.name = "NCP Tracking.xls" Then
MsgBox ("NCP Tracking.xls is already open.")
Exit Sub
End If
Next wb
cdir = ActiveWorkbook.Path
Workbooks.Open cdir & "\NCP Tracking.xls"
Application.Run ("RunUpdate")
End Sub

I also tried Application.Run ("NCP Tracking.xls!RunUpdate"), but still says
"Can not find"
What I gotta do?

Mike F


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Open WorkBook & Run Macro

Mike,

it is the embedded spaces I think. Try

Application.Run ("'NCP Tracking.xls'!RunUpdate")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mike Fogleman" wrote in message
...
From code in one workbook I want to open another workbook and run a
procedure that is in it. I have this in the first workbook:
Sub RunTracking()
Dim cdir As String
Dim wb As Workbook

For Each wb In Workbooks
If wb.name = "NCP Tracking.xls" Then
MsgBox ("NCP Tracking.xls is already open.")
Exit Sub
End If
Next wb
cdir = ActiveWorkbook.Path
Workbooks.Open cdir & "\NCP Tracking.xls"
Application.Run ("RunUpdate")
End Sub

I also tried Application.Run ("NCP Tracking.xls!RunUpdate"), but still

says
"Can not find"
What I gotta do?

Mike F




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Open WorkBook & Run Macro

Thanks Bob, that was it. Silly me tried to use the Help example for the Run
Method which says:
mySum = Application.Run("MYCUSTOM.XLM!My_Func_Sum", 1, 5)
MsgBox "Macro result: " & mySumNo single quotes in that is there?Mike F"Bob
Phillips" wrote in message
...
Mike,

it is the embedded spaces I think. Try

Application.Run ("'NCP Tracking.xls'!RunUpdate")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mike Fogleman" wrote in message
...
From code in one workbook I want to open another workbook and run a
procedure that is in it. I have this in the first workbook:
Sub RunTracking()
Dim cdir As String
Dim wb As Workbook

For Each wb In Workbooks
If wb.name = "NCP Tracking.xls" Then
MsgBox ("NCP Tracking.xls is already open.")
Exit Sub
End If
Next wb
cdir = ActiveWorkbook.Path
Workbooks.Open cdir & "\NCP Tracking.xls"
Application.Run ("RunUpdate")
End Sub

I also tried Application.Run ("NCP Tracking.xls!RunUpdate"), but still

says
"Can not find"
What I gotta do?

Mike F






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Open WorkBook & Run Macro

That's the main problem with help that I find, it always gives a basic
example, usually one that you can work out yourself, and never shows you how
to really push it.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mike Fogleman" wrote in message
...
Thanks Bob, that was it. Silly me tried to use the Help example for the

Run
Method which says:
mySum = Application.Run("MYCUSTOM.XLM!My_Func_Sum", 1, 5)
MsgBox "Macro result: " & mySumNo single quotes in that is there?Mike

F"Bob
Phillips" wrote in message
...
Mike,

it is the embedded spaces I think. Try

Application.Run ("'NCP Tracking.xls'!RunUpdate")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mike Fogleman" wrote in message
...
From code in one workbook I want to open another workbook and run a
procedure that is in it. I have this in the first workbook:
Sub RunTracking()
Dim cdir As String
Dim wb As Workbook

For Each wb In Workbooks
If wb.name = "NCP Tracking.xls" Then
MsgBox ("NCP Tracking.xls is already open.")
Exit Sub
End If
Next wb
cdir = ActiveWorkbook.Path
Workbooks.Open cdir & "\NCP Tracking.xls"
Application.Run ("RunUpdate")
End Sub

I also tried Application.Run ("NCP Tracking.xls!RunUpdate"), but still

says
"Can not find"
What I gotta do?

Mike F








Reply
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
Macro in 2nd Open workbook Steve Excel Discussion (Misc queries) 1 January 28th 08 05:35 PM
Run a macro when I open a workbook CraigJ Excel Discussion (Misc queries) 1 June 13th 07 04:04 PM
How to Run Macro in open workbook/s hni Excel Discussion (Misc queries) 1 October 31st 05 10:14 AM
how can I run a macro when I open a workbook? filo666 Excel Discussion (Misc queries) 2 March 2nd 05 07:56 PM
Macro to open another workbook missmelis01[_2_] Excel Programming 1 August 27th 04 08:37 PM


All times are GMT +1. The time now is 12:16 AM.

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"