Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Application.Run with multiple workbooks

I have a problem with the Application.Run method. If you have two workbooks open, each with a code module, Application.Run seems to only work with one of the workbooks at a time and Application.Activate does not change which module's procedures will work

For example, open Excel 2000 (Book1) go to the VBA editor and type workbooks.add in the debug window. Add a module to each of the VBAprojects. Put Sub A containing msgbox("A") in one module and Sub B containing Msgbox("B") in the other.

Type Call A in the immediate pane and you get "Sub or function not defined". Workbooks(1).activate does not help. Using the syntax project.module.procedure does not help either

I need to call a procedure in the second Project from a procedure in the first using Application.Run(ProcName) - how do I do it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Application.Run with multiple workbooks


in my test, book2 has a sub called 'HelloWorld'
from another open workbook

Application.Run "book2!HelloWorld"


The sub must be public (which is the default) and must be
in a standard code module

Patrick Molloy
Microsoft Excel MVP
-------------------
I Feel Great


-----Original Message-----
I have a problem with the Application.Run method. If you

have two workbooks open, each with a code module,
Application.Run seems to only work with one of the
workbooks at a time and Application.Activate does not
change which module's procedures will work.

For example, open Excel 2000 (Book1) go to the VBA

editor and type workbooks.add in the debug window. Add a
module to each of the VBAprojects. Put Sub A containing
msgbox("A") in one module and Sub B containing Msgbox
("B") in the other.

Type Call A in the immediate pane and you get "Sub or

function not defined". Workbooks(1).activate does not
help. Using the syntax project.module.procedure does not
help either.

I need to call a procedure in the second Project from a

procedure in the first using Application.Run(ProcName) -
how do I do it?
.

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
Updating Workbooks from multiple links Workbooks TimJames Excel Worksheet Functions 1 December 15th 07 03:34 PM
i need help with a function application with multiple arguments tarabull Excel Worksheet Functions 3 November 3rd 07 03:36 AM
Multiple Lookup Application JAD Excel Worksheet Functions 2 June 4th 07 10:38 PM
Multiple Application.UserNames Bob Excel Discussion (Misc queries) 4 May 15th 06 06:19 PM
Combine multiple workbooks into 1 workbook w/ multiple worksheets buffgirl71 Excel Discussion (Misc queries) 1 May 13th 06 12:28 PM


All times are GMT +1. The time now is 03:11 AM.

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

About Us

"It's about Microsoft Excel"