Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Call a macro in anothe file

I have a command button on Sheet1
the click event says
application.run "personal.xls!OtherMacro"

The called macro is in a code module named "MyModule" in personal.xls. It is
declared as
Sub OtherMacro()

I am getting an application error every time the click event fires, any
ideas? TIA ... Bill


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Call a macro in anothe file

A sub to be Public to be used by any other module:
Public Sub OtherMacro()

"William Benson" wrote:

I have a command button on Sheet1
the click event says
application.run "personal.xls!OtherMacro"

The called macro is in a code module named "MyModule" in personal.xls. It is
declared as
Sub OtherMacro()

I am getting an application error every time the click event fires, any
ideas? TIA ... Bill



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Call a macro in anothe file

This sub is in a module called CharStats, in Personal.xls:

Public Sub FindChar()
frmFindCharacters.Show
End Sub

This is the click event of command button on a sheet in another open file:

Private Sub CommandButton1_Click()
Application.Run "Personal.xls!FindChar"
End Sub

This is the error message I am getting: The macro 'Personal.xls!FindChar'
cannot be found.

Any help?


"K Dales" wrote in message
...
A sub to be Public to be used by any other module:
Public Sub OtherMacro()

"William Benson" wrote:

I have a command button on Sheet1
the click event says
application.run "personal.xls!OtherMacro"

The called macro is in a code module named "MyModule" in personal.xls. It
is
declared as
Sub OtherMacro()

I am getting an application error every time the click event fires, any
ideas? TIA ... Bill





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Call a macro in anothe file

Try this:

1. Insert a module in the workbook where your button is; (VBE, insert,
module)
2. Copy the code from your Personal.xls to this module;
3. Go in the sheet where you have the button (right-click reassign
macro, and point to the one in your workbook)
4. ... Good Luck

Philippe Léveillé

"William Benson" a écrit dans le message de news:
...
I have a command button on Sheet1
the click event says
application.run "personal.xls!OtherMacro"

The called macro is in a code module named "MyModule" in personal.xls. It
is declared as
Sub OtherMacro()

I am getting an application error every time the click event fires, any
ideas? TIA ... Bill



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Call a macro in anothe file

Reproduced the situation you describe and it worked fine for me.

xl2003, but I wouldn't expect it to be different in other versions.
--
Regards,
Tom Ogilvy

"William Benson" wrote in message
...
This sub is in a module called CharStats, in Personal.xls:

Public Sub FindChar()
frmFindCharacters.Show
End Sub

This is the click event of command button on a sheet in another open file:

Private Sub CommandButton1_Click()
Application.Run "Personal.xls!FindChar"
End Sub

This is the error message I am getting: The macro 'Personal.xls!FindChar'
cannot be found.

Any help?


"K Dales" wrote in message
...
A sub to be Public to be used by any other module:
Public Sub OtherMacro()

"William Benson" wrote:

I have a command button on Sheet1
the click event says
application.run "personal.xls!OtherMacro"

The called macro is in a code module named "MyModule" in personal.xls.

It
is
declared as
Sub OtherMacro()

I am getting an application error every time the click event fires, any
ideas? TIA ... Bill









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Call a macro in anothe file

I had it declared twice, in separate modules. Why the %$#$^$%$ can't Excel
just say so!

Sorry Tom/Philippe

"Philippe Léveillé" wrote in message
...
Try this:

1. Insert a module in the workbook where your button is; (VBE, insert,
module)
2. Copy the code from your Personal.xls to this module;
3. Go in the sheet where you have the button (right-click reassign
macro, and point to the one in your workbook)
4. ... Good Luck

Philippe Léveillé

"William Benson" a écrit dans le message de news:
...
I have a command button on Sheet1
the click event says
application.run "personal.xls!OtherMacro"

The called macro is in a code module named "MyModule" in personal.xls. It
is declared as
Sub OtherMacro()

I am getting an application error every time the click event fires, any
ideas? TIA ... Bill





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
'The process cannot access the file because it is in use by anothe CJZ Excel Discussion (Misc queries) 1 November 7th 06 05:38 AM
Call a batch file from an Excel Macro Alex Horan Excel Discussion (Misc queries) 0 March 2nd 06 03:29 PM
Call a batch file from an Excel Macro Gary''s Student Excel Discussion (Misc queries) 0 March 2nd 06 03:26 PM
open file, then call macro... won't work Kieran1028[_8_] Excel Programming 3 December 13th 04 05:22 PM
How to call File Open / Save Window in a Macro [email protected] Excel Programming 1 January 28th 04 03:46 PM


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