+ Reply to Thread
Results 1 to 3 of 3

CORRECT SYNTAX FOR RUN...

  1. #1

    CORRECT SYNTAX FOR RUN...

    Hi,

    I've been trying to solve this problem for a few days now. What is the
    correct
    syntax for Run, when executing a sub procedure in a DIFFERENT workbook
    under the following conditions: the procedure has arguments, and you
    are passing the code to run the macro with its arguments as 1 string:

    sub RunMacro(STRING)

    Application. Run STRING

    End Sub

    Where STRING has a value like "FILE.XLS!MACRO ARG1, ARG2"

    Thanks for any help you can give

    Regards,

    Ian


  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Ian, i'm not entirely sure what it is your trying to do if all you want to do is run a macro you just call it like Call RunMacro. I created a macro called Test1 and put this line in the Worksheet SelectionChange event (just cos i'm lazy) Application.Run ("Test1"), so when i selected a new cell it run the macro.....it worked fine.

    Regards,
    Simon

  3. #3
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Perhaps something like this?

    Application.Workbooks.Open ("C:\Documents and Settings\Simon\Desktop\test.xls")
    With Workbooks("test.xls")
    Application.Run ("Macro1")
    End With

+ 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