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


I have a Master file containing a macro that opens a number of other
workbooks, collects data and the creates statistics from this retreived data,
work well. Now I need to create some statistics in on of the workbooks that I
open from my Master. In this Slave file I have the macro that I want to run,
but only when the Master is running. How can i call the macro in the Slave
worksheet from the code in the Master macro.

Greatful for all help!

--
Tomas S
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Call macro in other sheet


Hi Thomas

Look at this:

Application.Run ("SlaveFile.xls!Macro1")

Regards,
Per

"Tomas Stroem" skrev i meddelelsen
...
I have a Master file containing a macro that opens a number of other
workbooks, collects data and the creates statistics from this retreived
data,
work well. Now I need to create some statistics in on of the workbooks
that I
open from my Master. In this Slave file I have the macro that I want to
run,
but only when the Master is running. How can i call the macro in the Slave
worksheet from the code in the Master macro.

Greatful for all help!

--
Tomas S


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Call macro in other sheet


Per,
Works partially. but nor quite.
The result now is this, Macro Error 1004: "Can not find the macro
"Statistics" in file..."

Macro name is correct as well as file name, any idea of more adaptions
needed??

--
Tomas S


"Per Jessen" wrote:

Hi Thomas

Look at this:

Application.Run ("SlaveFile.xls!Macro1")

Regards,
Per

"Tomas Stroem" skrev i meddelelsen
...
I have a Master file containing a macro that opens a number of other
workbooks, collects data and the creates statistics from this retreived
data,
work well. Now I need to create some statistics in on of the workbooks
that I
open from my Master. In this Slave file I have the macro that I want to
run,
but only when the Master is running. How can i call the macro in the Slave
worksheet from the code in the Master macro.

Greatful for all help!

--
Tomas S



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Call macro in other sheet


"Statistics" OR "Statistics.xls"

If this post helps click Yes
---------------
Jacob Skaria


"Tomas Stroem" wrote:

Per,
Works partially. but nor quite.
The result now is this, Macro Error 1004: "Can not find the macro
"Statistics" in file..."

Macro name is correct as well as file name, any idea of more adaptions
needed??

--
Tomas S


"Per Jessen" wrote:

Hi Thomas

Look at this:

Application.Run ("SlaveFile.xls!Macro1")

Regards,
Per

"Tomas Stroem" skrev i meddelelsen
...
I have a Master file containing a macro that opens a number of other
workbooks, collects data and the creates statistics from this retreived
data,
work well. Now I need to create some statistics in on of the workbooks
that I
open from my Master. In this Slave file I have the macro that I want to
run,
but only when the Master is running. How can i call the macro in the Slave
worksheet from the code in the Master macro.

Greatful for all help!

--
Tomas S



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Call macro in other sheet


Application.Run ("Supplier Total.xls!Statistics()")

--
Tomas S


"Jacob Skaria" wrote:

"Statistics" OR "Statistics.xls"

If this post helps click Yes
---------------
Jacob Skaria


"Tomas Stroem" wrote:

Per,
Works partially. but nor quite.
The result now is this, Macro Error 1004: "Can not find the macro
"Statistics" in file..."

Macro name is correct as well as file name, any idea of more adaptions
needed??

--
Tomas S


"Per Jessen" wrote:

Hi Thomas

Look at this:

Application.Run ("SlaveFile.xls!Macro1")

Regards,
Per

"Tomas Stroem" skrev i meddelelsen
...
I have a Master file containing a macro that opens a number of other
workbooks, collects data and the creates statistics from this retreived
data,
work well. Now I need to create some statistics in on of the workbooks
that I
open from my Master. In this Slave file I have the macro that I want to
run,
but only when the Master is running. How can i call the macro in the Slave
worksheet from the code in the Master macro.

Greatful for all help!

--
Tomas S




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Call macro in other sheet


When you have a space in the workbook name add a single quote. Try the below.

Application.Run ("'Supplier Total.xls'!Statistics")

If this post helps click Yes
---------------
Jacob Skaria


"Tomas Stroem" wrote:

Application.Run ("Supplier Total.xls!Statistics()")

--
Tomas S


"Jacob Skaria" wrote:

"Statistics" OR "Statistics.xls"

If this post helps click Yes
---------------
Jacob Skaria


"Tomas Stroem" wrote:

Per,
Works partially. but nor quite.
The result now is this, Macro Error 1004: "Can not find the macro
"Statistics" in file..."

Macro name is correct as well as file name, any idea of more adaptions
needed??

--
Tomas S


"Per Jessen" wrote:

Hi Thomas

Look at this:

Application.Run ("SlaveFile.xls!Macro1")

Regards,
Per

"Tomas Stroem" skrev i meddelelsen
...
I have a Master file containing a macro that opens a number of other
workbooks, collects data and the creates statistics from this retreived
data,
work well. Now I need to create some statistics in on of the workbooks
that I
open from my Master. In this Slave file I have the macro that I want to
run,
but only when the Master is running. How can i call the macro in the Slave
worksheet from the code in the Master macro.

Greatful for all help!

--
Tomas S


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Call macro in other sheet


This was saved from a post for a similar question. You'll have to change the
workbook name from personal.xls to the real name.

Dim pWkbk as workbook
set pwkbk = workbooks("Personal.xls")
application.run "'" & pwkb.name & "'!macronamehere", "parm1", "parm2"

or if you're returning a value from a function:

dim res as string 'or variant or long or ...
res = application.run("'" & pwkb.name & "'!macronamehere", "parm1", "parm2")

You could also create a reference to this personal.xls workbook and call it just
like it was built into excel.

Tools|references
(but give the personal.xls's project a nice unique name (not VBAProject).

ps.

If you're using a function living in personal.xls inside a cell:
=personal.xls!functionnamehere(a1,b1,c1)

or save the file as an addin (*.xla) and use it in the cell like it's built into
excel:
=functionnamehere(a1,b1,c1)

Tomas Stroem wrote:

I have a Master file containing a macro that opens a number of other
workbooks, collects data and the creates statistics from this retreived data,
work well. Now I need to create some statistics in on of the workbooks that I
open from my Master. In this Slave file I have the macro that I want to run,
but only when the Master is running. How can i call the macro in the Slave
worksheet from the code in the Master macro.

Greatful for all help!

--
Tomas S


--

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
Inter sheet call ups Mr. DP Excel Discussion (Misc queries) 0 November 30th 06 06:10 AM
Call macro stored in Excel workbook from Outlook's macro Gvaram Excel Programming 0 October 4th 06 05:47 PM
How do I change a macro to call a sheet from another workbook Nic@Rolls-Royce[_7_] Excel Programming 2 February 9th 04 08:47 AM
How do I change a macro to call a sheet from another workbook Rob van Gelder[_4_] Excel Programming 0 February 9th 04 08:30 AM
Call an Excel Macro when a Sheet is selected [email protected] Excel Programming 0 October 16th 03 07:01 PM


All times are GMT +1. The time now is 06:14 PM.

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"