LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Calling subroutine defined in another workbook (autostart workbook)

TestMsg is stored in:

MyMacros (MyMacros.xls)
Modules
TestMsg

On Nov 16, 11:51*am, Dave Peterson wrote:
My first suggestion is to make sure that TestMsg is in a General module -- not
under ThisWorkbook and not behind a worksheet.

On 11/15/2010 18:40, Scott Bass wrote:



Hi,


I have a subroutine defined in my auto start workbook, which is named
MyMacros.xls:


MyMacros.xls:


Option Explicit


Sub TestMsg()
* * *MsgBox "Test Message"
End Sub


I want to run this macro whenever the save event runs in another
workbook, say temp.xls:


Temp.xls:


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
* * *Application.Run "MyMacros.xls!TestMsg"
End Sub


This doesn't work. *I get the error message:


The macro 'MyMacros.xls!TestMsg' cannot be found. *I'm positive
MyMacros.xls is open (even if the workbook is hidden). *Alt-F11 shows
MyMacros.xls is open and the TestMsg module is defined.


How can I call the TestMsg sub-routine whenever I click Save in
another workbook?


Thanks,
Scott


--
Dave Peterson


 
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
Error Calling A subroutine from a User Defined Function (UDF) that Carlos[_8_] Excel Programming 2 August 25th 08 07:16 PM
Exceeding 65K of defined names within workbook causes workbook to go into repair mode when it is opened Ronald Dodge[_2_] Excel Programming 13 May 18th 07 02:24 PM
HELP! Calling subroutine in different workbook ChrisWalker Excel Programming 3 March 1st 06 11:32 AM
How to check workbook is already opened before passing the workbook obj to a subroutine in Word Bon Excel Programming 2 January 19th 06 09:54 AM
Calling a Public Subroutine in a Different Workbook Raul Excel Programming 2 August 24th 05 04:27 AM


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