Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Antonio
 
Posts: n/a
Default Execute a sub in a different project

How do I run a sub that is declared as public in a different open workbook
(project)?

Thanks,

Antonio
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Execute a sub in a different project

dim otherworkbook as workbook

set otherworkbook = workbooks("yourothernamehere.xls")

application.run "'" & otherworkbook.name & "'!macronamehere"



Antonio wrote:

How do I run a sub that is declared as public in a different open workbook
(project)?

Thanks,

Antonio


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett
 
Posts: n/a
Default Execute a sub in a different project

try
application.run otherworkbook.xls!mymacro

--
Don Guillett
SalesAid Software

"Antonio" wrote in message
...
How do I run a sub that is declared as public in a different open
workbook
(project)?

Thanks,

Antonio



  #4   Report Post  
Posted to microsoft.public.excel.misc
Antonio
 
Posts: n/a
Default Execute a sub in a different project

I have used

I get:

Run-time error '1004':

The macro 'myworkbook.xls!kill_max_min' cannot be found.

In myworkbook I have

Public Sub kill_max_min()

Application.OnTime runwhen, "max_min", , False

End Sub


What am I doing wrong?

Thanks,

Antonio

"Don Guillett" wrote:

try
application.run otherworkbook.xls!mymacro

--
Don Guillett
SalesAid Software

"Antonio" wrote in message
...
How do I run a sub that is declared as public in a different open
workbook
(project)?

Thanks,

Antonio




  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Execute a sub in a different project

What did you use?

Antonio wrote:

I have used

I get:

Run-time error '1004':

The macro 'myworkbook.xls!kill_max_min' cannot be found.

In myworkbook I have

Public Sub kill_max_min()

Application.OnTime runwhen, "max_min", , False

End Sub

What am I doing wrong?

Thanks,

Antonio

"Don Guillett" wrote:

try
application.run otherworkbook.xls!mymacro

--
Don Guillett
SalesAid Software

"Antonio" wrote in message
...
How do I run a sub that is declared as public in a different open
workbook
(project)?

Thanks,

Antonio





--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
Antonio
 
Posts: n/a
Default Execute a sub in a different project

Sorry, I have used

Application.Run "myworkbook.xls!kill_max_min"

I have also tried


Dim otherworkbook As Workbook
Set otherworkbook = Workbooks("myworkbook.xls")
Application.Run "'" & otherworkbook.Name & "!kill_max_min"

The run method does seem to pint to myworkbook.xls but cannot find the sub

"Dave Peterson" wrote:

What did you use?

Antonio wrote:

I have used

I get:

Run-time error '1004':

The macro 'myworkbook.xls!kill_max_min' cannot be found.

In myworkbook I have

Public Sub kill_max_min()

Application.OnTime runwhen, "max_min", , False

End Sub

What am I doing wrong?

Thanks,

Antonio

"Don Guillett" wrote:

try
application.run otherworkbook.xls!mymacro

--
Don Guillett
SalesAid Software

"Antonio" wrote in message
...
How do I run a sub that is declared as public in a different open
workbook
(project)?

Thanks,

Antonio




--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Execute a sub in a different project

You dropped a single quote from this attempt:
Application.Run "'" & otherworkbook.Name & "'!kill_max_min"

But I don't think that's the problem.

Both versions (after correction) worked ok for me.

Is Kill_max_min in a general module?



Antonio wrote:

Sorry, I have used

Application.Run "myworkbook.xls!kill_max_min"

I have also tried


Dim otherworkbook As Workbook
Set otherworkbook = Workbooks("myworkbook.xls")
Application.Run "'" & otherworkbook.Name & "!kill_max_min"

The run method does seem to pint to myworkbook.xls but cannot find the sub

"Dave Peterson" wrote:

What did you use?

Antonio wrote:

I have used

I get:

Run-time error '1004':

The macro 'myworkbook.xls!kill_max_min' cannot be found.

In myworkbook I have

Public Sub kill_max_min()

Application.OnTime runwhen, "max_min", , False

End Sub

What am I doing wrong?

Thanks,

Antonio

"Don Guillett" wrote:

try
application.run otherworkbook.xls!mymacro

--
Don Guillett
SalesAid Software

"Antonio" wrote in message
...
How do I run a sub that is declared as public in a different open
workbook
(project)?

Thanks,

Antonio




--

Dave Peterson


--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson
 
Posts: n/a
Default Execute a sub in a different project

Just to cover all the bases, is the workbook containing the macro
open? It must be.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Antonio" wrote in message
...
Sorry, I have used

Application.Run "myworkbook.xls!kill_max_min"

I have also tried


Dim otherworkbook As Workbook
Set otherworkbook = Workbooks("myworkbook.xls")
Application.Run "'" & otherworkbook.Name & "!kill_max_min"

The run method does seem to pint to myworkbook.xls but cannot
find the sub

"Dave Peterson" wrote:

What did you use?

Antonio wrote:

I have used

I get:

Run-time error '1004':

The macro 'myworkbook.xls!kill_max_min' cannot be found.

In myworkbook I have

Public Sub kill_max_min()

Application.OnTime runwhen, "max_min", , False

End Sub

What am I doing wrong?

Thanks,

Antonio

"Don Guillett" wrote:

try
application.run otherworkbook.xls!mymacro

--
Don Guillett
SalesAid Software

"Antonio" wrote in
message
...
How do I run a sub that is declared as public in a
different open
workbook
(project)?

Thanks,

Antonio




--

Dave Peterson



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
Stacked Bar graph Pooja Excel Discussion (Misc queries) 6 March 6th 06 03:30 PM
How to convert MS Project to MS Excel. I don't have MS Project. Jane Excel Discussion (Misc queries) 1 February 20th 06 10:01 PM
Cannot save Project file as MS Access file Jumpinjackflash Excel Discussion (Misc queries) 1 January 11th 06 11:35 PM
Missing library when running 98 project on 2003 Mary Omond Excel Discussion (Misc queries) 0 May 2nd 05 01:36 PM
Subtotal of Subtotal displays Grand Total in wrong row Thomas Born Excel Worksheet Functions 5 January 6th 05 01:46 PM


All times are GMT +1. The time now is 07:29 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"