Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Application.Run (XP)

    Well it is suppose to run unfortunately it does not. Perhaps it's just me. I have two workbooks the first workbook contains code to call code "SomeCode" in the second workbook.

    Application.Run "MyFile.xls!SomeCode"

    Any assistance would be appreciated.
    John

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Application.Run (XP)

    Try:

    <pre> Application.Run ("MyFile.xls!SomeCode")
    </pre>


    With the parenthesis around the parameter. If that does not help, could you tell us if the two workbooks are in the same folder, and what error you are getting.
    Legare Coleman

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Application.Run (XP)

    Is MyFile.xls in the default document folder for Excel? If not, you'll have to specify the path, and if that contains spaces, you must enclose the entire path in single quotes:

    <code>Application.Run "'C:My Excel FilesMyFile.xls'!SomeCode"</code>

  4. #4
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Application.Run (XP)

    Legare,

    The files are located in the same directory. Both files are open (WB1 & WB2). WB1's code opens WB2 and then tries to run code of WB2 which is the active workbook.

    John

  5. #5
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Application.Run (XP)

    Too many long hours....I just noticed that I advertently deleted the code in WB2 which I was trying to run.

    <img src=/S/bash.gif border=0 alt=bash width=35 height=39>

  6. #6
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Application.Run (XP)

    That does make it hard to find. <img src=/S/yep.gif border=0 alt=yep width=15 height=15>
    Legare Coleman

Posting Permissions

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