+ Reply to Thread
Results 1 to 4 of 4

Run macro in workbook B from a macro in Workbook A

  1. #1
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186

    Run macro in workbook B from a macro in Workbook A

    Hi,
    I have a Workbook A where I do most of my work. I have also a Workbook B where I store data.

    I need a macro in my Workbook A that opens and run a specific macro in my workbook B.

    To open Workbook B Im using the following codes in Workbook A
    Please Login or Register  to view this content.
    Now that Workbook B is open, to run the macro in Workbook B (macro name= "DataColor") I tried:
    Please Login or Register  to view this content.
    This last line (RUN) is not working to me. What am I doing wrong?

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try removing the brackets
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186
    Thanks Roy.
    I tried your suggestion in a new set of workbooks and it works fine.
    But now I tried in my original documents and it sends the error 1004/(It cant find the macro).
    Do I need to write the module name between the filename and macro name?
    I already checked the filename and macro name to be sure it is not a typo.
    Do you know of any reason it couldnt find a macro if it is in there?

    I thank you very much.

  4. #4
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186

    Thumbs up

    I found the problem.
    It looks like the run command cant handle spaces or "-" in the finename.
    In my drive, the filename has a space ("DataStore V3.xls").

    I rename the filename (in my hardrive and in the macro procedure) to "DataStoreV3.xls" and now it works fine.

    Thanks a lot Roy.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1