Playing a macro from another workbook

I have a workbook that contains a macro I need to run on a large number of 
other workbooks.  Is it possible to play a macro from another workbook on the 
current workbook with out copying either the data or the macro manually?    

I've found that if I open the workbook containing the macro, and then open 
one of the "target" workbooks, I can open the Run Macro dialog box in the 
target workbook and all macros in both workbooks are displayed if "All Open 
Workbooks" is selected in the "Macros in:" field on the Macro dialog.  
However if I select the macro I need to run from the "source" workbook, the 
macro only runs on it's workbook, not the "target".

Without copying and pasting the data from the target workbooks into the 
source workbook and then running the macro, is there a simpler way?

Thanks for any help
0
Jim8980 (510)
2/23/2005 9:31:02 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
305 Views

Similar Articles

[PageSpeed] 10

Usually when you want your code to run against lots of workbooks, you write it
using Activesheet references and activeworkbook (not ThisWorkbook).



Jim wrote:
> 
> I have a workbook that contains a macro I need to run on a large number of
> other workbooks.  Is it possible to play a macro from another workbook on the
> current workbook with out copying either the data or the macro manually?
> 
> I've found that if I open the workbook containing the macro, and then open
> one of the "target" workbooks, I can open the Run Macro dialog box in the
> target workbook and all macros in both workbooks are displayed if "All Open
> Workbooks" is selected in the "Macros in:" field on the Macro dialog.
> However if I select the macro I need to run from the "source" workbook, the
> macro only runs on it's workbook, not the "target".
> 
> Without copying and pasting the data from the target workbooks into the
> source workbook and then running the macro, is there a simpler way?
> 
> Thanks for any help

-- 

Dave Peterson
0
ec357201 (5290)
2/23/2005 10:12:55 PM
Reply:

Similar Artilces:

Messages not delivered to another Routing Group HELP NEEDED
I have three routing groups ( exchange in the 3 of them are Exch 2k sp3 ). Mail from one server ( in my headquarter routing group ) to another ( in one branch office routing group ) is getting stucked in MESSAGES WITH UNREACHABLE DESTINATION and not routed to that server. Connectors seems to be working just fine. After add my other exchange server from my headqurter group to the connector to be albe to send mail it shows the queue now in the connector but does not sends anything. Otherwise, mail from my branch office to my headquarter correctly sends mail. Any help would be gre...

Run macro only if
Hi, i need a macro to run if A1 contains "John" and C1 contains "Mari", and if D1 is blank. If this criteria is not mached, then the macro to display a message. Can this be done? Thanks! Hi, Is this what you mean Sub somemacro() Set sht = Sheets("Sheet1") ' change to suit With sht If UCase(.Range("A1")) <> "JOHN" _ Or UCase(.Range("C1")) <> "MARI" _ Or .Range("D1") <> "" Then MsgBox "Criteria not met" Exit Sub End If End With 'Your code End Su...

How to add another user's Contacts folder to my Address Book?
Background: Exchange 2003 Server w/ Outlook 2000/2003 clients. I can add any Contacts folders in my mailbox to my Address Book by going into the Properties of the folder and checking "Show this folder as an e-mail Address Book" on the "Outlook Address Book" tab. However, if I have another user's mailbox (to which I have full permission) in my Folder List, I do not have this option in any of their Contacts folders. How do I add another user's Contacts folder, displayed in my Folder List, to my Address Book? TIA, roshan After a bit of research on SlipStick.com...

global macro.xls
I have an Excel file that if I open it on a machine with office 2k not 2k3 and click on cells it gives a message "cant find global macro.xls." No such file exists on my machines, but it works fine in office 2k3. Any thoughts? Interesting. Can you send it to me? You can clear out any proprietary data first it you want. -- Jim Rech Excel MVP "spammeblind" <spammeblind@discussions.microsoft.com> wrote in message news:B5F2A847-73D9-4937-A181-EA7647B667A5@microsoft.com... |I have an Excel file that if I open it on a machine with office 2k not 2k3 and click on cel...

How do I look at two worksheets in one Excel workbook at same time
I know how to arrange windows to look at multiple workbooks. But I want to have two worksheets displayed at the same time from the same workbook. Is there a way to do that? Window - New Window this will create a second view of active workbook. Then you can do Window - Arrange, active workbook only. -- Best Regards, Luke M "PeoriaJean" <PeoriaJean@discussions.microsoft.com> wrote in message news:503A1BB9-2130-4346-A0AF-A461388397B2@microsoft.com... >I know how to arrange windows to look at multiple workbooks. But I want to > have two worksheets di...

copy and match data from one worksheet into another via script?
Hi all I have two worksheets 2 columns each The first sheet has ID and Name Column for example: Code ------------------- ID[/B] NAM 193948 Michael 684588 John 535279 Luke 098734 Matthe ------------------- my 2nd sheet Code ------------------- ID [B]NAM Michael John Luke Matthe ------------------- How do i use the first sheet to match up the names on the 2nd sheet and ultimately copy the ID numbers onto the 2nd sheet? This is just a simplified example. There are thousands of entries. Thank you if you have ...

Macro to send grab email address and open Outlook
Hi there I am trying to write a simple macro to be able to send an email based on an emai address in a form. tblAgency Details has a field EmailAddress (data type is text) I have a Command Button on a form frmAdd Agency Details to run a macro. Macro name is SendEmail - Action is only SendObject There are only two items in the Action Arguments To: =[EmailAddress] Edit Message: Yes (I only want Outlook to load with the email address) So far it does not work. When I have a field for a Web Address and the data type is a hyperlink that works well for me....

Add a new code macro
I have workbook that I am trying to use with a macro form another post on this form. It inserts a new row with the formulas and contents of the selected row. The problem is that it copies the row below the one selected, and because of this, I can not make a copy of row 2 below the column headers. Any ideas? Thanks. Here is the code: '/=======Start of Code==========================/ Sub InsertRowsAndFillFormulas() 'adds desired # of lines below the current line and ' copies the formulas to that/those lines 'added selection of more than one worksheet ' - Gary L. Brown &#...

Restoring another PST?
Hi everyone, I use the MS Outlook Backup tool, and it backs up daily. Early this week I imported the backed-up PST file ( over 1GB ) into my new PC and after a bit of fiddling to show the folders it did open up all the ones I wanted, yet seemed to be an old backup - maybe 12 weeks out of date. I had to use the machine so kept it like this, and have of course received many mails since then. I see another copy of the backup[ PST file and the date says it was created on Feb 19th, which would be right. My ( evantual! ) question is: how do I, in idiot-proof steps, go about restoring this other...

Workbook there but not visible! Help!
I was working on some VBA code for an excel application I am writing. I switched between the VBE and the spreadsheet and all of a sudden my workbook is no longer visible! In the VBE project explorer window it shows my project and my code but in the excel window...no workbook! Nothing! Ran a test procedure calling IsAddin to see if somehow I accidentally clicked a button/box telling Excel to make this file an addin but it returned false. I did close the file and re-open it. Any ideas? Maybe it's just off the visible screen: Window|Arrange|tiled (and resize manually) or maybe y...

How do I create a new macro in Outlook 2007?
Below is the macro, copied from MS Word, where it works perfectly! In Outlook I get all sorts of error messages and debugging, which I don't understand. Thanks for any help. Sub SafariCare() ' ' SafariCare Macro ' Macro recorded 6/4/2007 by Eva Wilson ' Selection.TypeText Text:= _ "Thank you for your participation in the SafariCare program! " Selection.TypeText Text:= _ " Attached are the program guidelines for your convenience. " Selection.TypeParagraph Selection.TypeParagraph Selection.TypeText Text:= _ ...

Selecting Charts in a Macro
I have a worksheet which contains 7 charts: 1st Chart = Chart 12 2nd Chart = Chart 7 3rd Chart = Chart 11 4th Chart = Chart 13 5th Chart = Chart 24 6th Chart = Chart 16 7th Chart = Chart 26 I have a macro which copies the worksheet it over to a new worksheet within the same workbook, the charts are then labelled: 1st Chart = Chart 9 2nd Chart = Chart 7 3rd Chart = Chart 13 4th Chart = Chart 10 5th Chart = Chart 2 6th Chart = Chart 12 7th Chart = Chart 15 The macro then tries to select each chart and change the source data, what I don't know is how excel will treat the chart numbers for...

Sound Play and Record
Win XP I have an onboard sound card toggled through the BIOS and also an On-Board sound card. With the onboard sound "enabled" Play works and Record works intermittently using MS Sound Recorder. With the onboard sound "disabled" I get the message: "Another application is play audio" when attempting to record or play. This seems completely backward. Running "Troubleshoot Sound" currently the microphone is recognized. Searching the internet yield a number of post indicating that XP Sound Record seems to be intermittent ...

Error 1004 Workbooks.Add Inplace-Activation
Hi ! I don't know if I am in the correct forum but here it comes any way Sub AddWorkBook() ThisWorkbook.Application.Workbooks.Add End Sub this simple macro only works from the debugger environment if I have XL Inplace Activated Is there any workarounds ? Best regards Magnus Is it so that XL has a state that it cannot do this ? COleClientItem::activeUIState Do I have to change state to pItem->DoVerb (OLEIVERB_OPEN, pView ); ???? "Magnus Pettersson" <magnus@businessvision.se> wrote in message news:uRngzLSvEHA.536@TK2MSFTNGP11.phx.gbl... > Hi ! > I d...

SendInput to a window belonging to another application thread
I'm trying to develop a simple application that can send input to a window belonging to another application thread, such as the microsoft on screen keyboard. The matter is that I don't understand how to know what was the last active window to which send the input from my dialog application. Looking on internet I've found a simple application called "Typematic" but it hide the application dialog before use the SendInput() api, it works well but I wish to obtain the same effect without hide the application dialog as the on screen keyboard does. How I could do it? Ho...

Macro to copy cell down
I want to create a macro that will copy the cell above to the active cell. OR the built-in key that will do that tenbob@optonline.net Bob A few seconds with the macro recorder set to "Relative Reference" gave me this. Sub Macro1() ' ' Macro1 Macro ' Macro recorded 11/3/2003 by Gord Dibben ' ' Selection.Copy ActiveCell.Offset(1, 0).Range("A1").Select ActiveSheet.Paste Application.CutCopyMode = False End Sub Gord Dibben XL2002 On Tue, 04 Nov 2003 04:26:28 GMT, Bob K. <tenbob@optonline.net> wrote: >I want to create a mac...

Can a workbook be used as a function
Hi, I have an excel workbook (A) that givern three parameters, temp1, temp and flow calculates the energy transfer for a process we conduct, have another workbook (B) which contains the hourly logged data for th process from which we generate monthly reports. Is it possible to use workbook (A) like a function and pass to it th three parameters from workbook (B) and return to workbook (B) th answer ie. energy transfered. Workbook (B) contain approx 750 logs so i need to repeat th calculation 750 times I could link the two which works for the first piece of logged data bu how to automatically...

Who could tell me which file tha macro _COM_SMARTPTR_TYPEDEF is defined in?
comdef.h ??? Tom "Lee Tow" <fbjlt@pub3.fz.fj.cn> wrote in message news:Ovpw7IUbHHA.5052@TK2MSFTNGP05.phx.gbl... > > Lee Tow wrote: > Who could tell me which file tha macro _COM_SMARTPTR_TYPEDEF is defined in? Go buy Visual Assist from Whole Tomato Software. Without this you'll get crazy searching for definitions. Regards, Stuart On Mar 23, 7:53 am, "Lee Tow" <f...@pub3.fz.fj.cn> wrote: All you have to do is use Find in Files and search VC directory. It is defined in comdef.h. --- Ajay ...

Problem with Macro Code
I have the following selected piece of Code that hits debug on line "ActiveSheet.Paste". The reason it does is that a command window comes up saying "Do you want to Replace the Contents of the Destination Cells" - how can I automate this to say "Yes" within my code? Sheets("Claim Form").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True ActiveSheet.Unprotect Password:="123" Range("A1").Select Cells.Select Selection.Copy Sheets("E-Claim").Visible = True Sheets("E-Claim&...

Names of Sheets in workbook
Hi, I was wondering if anyone could help. I have a spreadsheet with 4 worksheets in it. I need to create a Table of Contents on the first sheet listing th other 39 sheets in the document. Does anyone know a quick way to generate a list of the sheets in th workbook? Any help would be appreciated. Thanks, Mark Piitchford -- Message posted from http://www.ExcelForum.com Hi have a look at http://www.mvps.org/dmcritchie/excel/buildtoc.htm -- Regards Frank Kabel Frankfurt, Germany > Hi, > > I was wondering if anyone could help. I have a spreadsheet with 40 > worksheets in it...

Embedding a single workbook in a word doc
I prepare memos and I insert a bunch of tables out of a single excel file with a bunch of interlinked sheets. I typically insert them as pictures or linked pictures; however we often email the memo around for comments and and it gets complicated to have multiple versions and keep the links current. The other option is to insert the tables as embedded objects; however, if I do that, each table becomes a separate excel file, so I can=92t make changes to one and have it reflected in the tables throughout the document. Is there any way to create a single embedded workbook which I use several ti...

macro to make different tabs in a same sheet
i have a column in my spreadsheet where there are different names can u suggest a macro which makes different tabs in that same exce workbook with the names of different ppl in front of names there is data, i want that data to be transferre also along with the respective names in that tab thank u frnd -- Message posted from http://www.ExcelForum.com Try this example The names are in column A of a sheet named Sheet1 Sub test() Dim cell As Range Dim WSNew As Worksheet For Each cell In Sheets("Sheet1").Columns("A").Cells.SpecialCells(xlCellTypeConstants) Set ...

R1C1 with macros
I'm trying to define a relative range of cells in a macro and copy the formulas from that range to the next row below using R1C1 cell addressing style. I can't seem to get the the thing to go. Anyone know how? Russ Russ I'm not really understanding what you want to do but if, for example you want to copy a relative formula, say in A13 to A1000 then you could use the line Range("A13:A1000").FillDown -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS "Russ" <Rusty@notathome.net> wrote in message ne...

excel 4.0 macro removal tool
Dear all, i am looking for excel 4.0 macro removal tool from excel 97 file.Actually we are facing such problem from two months and it gives pain.some excel files contain macro of excel 4.0 with "very hidden and very protective" attribute so that we cannot remove it.i have searched on net and found that there are some tools called macro remover which can remove all types of macros from excel file including excel 4.0 macro from excel 97 file,but it charges which i cannot afford.so if there any tool that can remove particular excel 4.0 macro from excel 97 file please let me know...

Macro button on toolbar
Hi How can I make a specific button for a workbook and assign a specific macro program for this. I have a problem of a button run every workbook. Thanks Daniel ...