+ Reply to Thread
Results 1 to 6 of 6

passing arguments by postion through application.run

  1. #1
    ben
    Guest

    passing arguments by postion through application.run

    I am trying to call a macro from a seperate workbook than the one that called
    it, but the sub calling the other sub needs to pass named arguments
    (noh(),nohl()) but the application.run method does not allow the passing of
    named arguments, it says it they need to be passed by postion. I'm not quite
    sure what that means, how do I cause that other macro to be open
    "workbook1!module1.macro",noh,nohl while passing those arguments (variables)
    either with application.run or another syntax?

  2. #2
    Tom Ogilvy
    Guest

    Re: passing arguments by postion through application.run

    ApplicationRun "workbook1.xls!module1.macro",noh,nohl

    where noh and noh1 ae the variables holding the values passed.

    --
    Regards,
    Tom Ogilvy


    "ben" <[email protected]> wrote in message
    news:[email protected]...
    > I am trying to call a macro from a seperate workbook than the one that

    called
    > it, but the sub calling the other sub needs to pass named arguments
    > (noh(),nohl()) but the application.run method does not allow the passing

    of
    > named arguments, it says it they need to be passed by postion. I'm not

    quite
    > sure what that means, how do I cause that other macro to be open
    > "workbook1!module1.macro",noh,nohl while passing those arguments

    (variables)
    > either with application.run or another syntax?




  3. #3
    ben
    Guest

    Re: passing arguments by postion through application.run

    Application.Run toexp + ".xls!module1.otay", noh, nohl
    is the exact code i am using where
    toexp = "BagSof1" I have ran in break just to be sure the variable is
    assigned correctly.
    and it still does not call the macro, excel hovers over that statement like
    it's trying to load a workbook or something then skips it with 'on error
    resume next' but when i turn it off it gives me an error box that says only
    '400' with no explination and the help button does nothing
    "Tom Ogilvy" wrote:

    > ApplicationRun "workbook1.xls!module1.macro",noh,nohl
    >
    > where noh and noh1 ae the variables holding the values passed.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "ben" <[email protected]> wrote in message
    > news:[email protected]...
    > > I am trying to call a macro from a seperate workbook than the one that

    > called
    > > it, but the sub calling the other sub needs to pass named arguments
    > > (noh(),nohl()) but the application.run method does not allow the passing

    > of
    > > named arguments, it says it they need to be passed by postion. I'm not

    > quite
    > > sure what that means, how do I cause that other macro to be open
    > > "workbook1!module1.macro",noh,nohl while passing those arguments

    > (variables)
    > > either with application.run or another syntax?

    >
    >
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: passing arguments by postion through application.run

    Is BagSof1.xls open. It should be.

    Using application.Run is pretty straightforward. I use it all the time to
    call the functions in the Analysis Toolpak - VBA (as one example).

    --
    Regards.
    Tom Ogilvy

    "ben" <[email protected]> wrote in message
    news:[email protected]...
    > Application.Run toexp + ".xls!module1.otay", noh, nohl
    > is the exact code i am using where
    > toexp = "BagSof1" I have ran in break just to be sure the variable is
    > assigned correctly.
    > and it still does not call the macro, excel hovers over that statement

    like
    > it's trying to load a workbook or something then skips it with 'on error
    > resume next' but when i turn it off it gives me an error box that says

    only
    > '400' with no explination and the help button does nothing
    > "Tom Ogilvy" wrote:
    >
    > > ApplicationRun "workbook1.xls!module1.macro",noh,nohl
    > >
    > > where noh and noh1 ae the variables holding the values passed.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "ben" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I am trying to call a macro from a seperate workbook than the one that

    > > called
    > > > it, but the sub calling the other sub needs to pass named arguments
    > > > (noh(),nohl()) but the application.run method does not allow the

    passing
    > > of
    > > > named arguments, it says it they need to be passed by postion. I'm not

    > > quite
    > > > sure what that means, how do I cause that other macro to be open
    > > > "workbook1!module1.macro",noh,nohl while passing those arguments

    > > (variables)
    > > > either with application.run or another syntax?

    > >
    > >
    > >




  5. #5
    ben
    Guest

    Re: passing arguments by postion through application.run

    yes it is open, which is why i thought it very strange that vba would
    hesitate over that line of code, would it make a difference if i made that
    code public sub otay instead of just sub otay?

    "Tom Ogilvy" wrote:

    > Is BagSof1.xls open. It should be.
    >
    > Using application.Run is pretty straightforward. I use it all the time to
    > call the functions in the Analysis Toolpak - VBA (as one example).
    >
    > --
    > Regards.
    > Tom Ogilvy
    >
    > "ben" <[email protected]> wrote in message
    > news:[email protected]...
    > > Application.Run toexp + ".xls!module1.otay", noh, nohl
    > > is the exact code i am using where
    > > toexp = "BagSof1" I have ran in break just to be sure the variable is
    > > assigned correctly.
    > > and it still does not call the macro, excel hovers over that statement

    > like
    > > it's trying to load a workbook or something then skips it with 'on error
    > > resume next' but when i turn it off it gives me an error box that says

    > only
    > > '400' with no explination and the help button does nothing
    > > "Tom Ogilvy" wrote:
    > >
    > > > ApplicationRun "workbook1.xls!module1.macro",noh,nohl
    > > >
    > > > where noh and noh1 ae the variables holding the values passed.
    > > >
    > > > --
    > > > Regards,
    > > > Tom Ogilvy
    > > >
    > > >
    > > > "ben" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > I am trying to call a macro from a seperate workbook than the one that
    > > > called
    > > > > it, but the sub calling the other sub needs to pass named arguments
    > > > > (noh(),nohl()) but the application.run method does not allow the

    > passing
    > > > of
    > > > > named arguments, it says it they need to be passed by postion. I'm not
    > > > quite
    > > > > sure what that means, how do I cause that other macro to be open
    > > > > "workbook1!module1.macro",noh,nohl while passing those arguments
    > > > (variables)
    > > > > either with application.run or another syntax?
    > > >
    > > >
    > > >

    >
    >
    >


  6. #6
    Tom Ogilvy
    Guest

    Re: passing arguments by postion through application.run

    It should be public by default. It should be in a general module and NOT be
    in any sheet moduler or the ThisWorkbook module.

    --
    Regards,
    Tom Ogilvy

    "ben" <[email protected]> wrote in message
    news:[email protected]...
    > yes it is open, which is why i thought it very strange that vba would
    > hesitate over that line of code, would it make a difference if i made that
    > code public sub otay instead of just sub otay?
    >
    > "Tom Ogilvy" wrote:
    >
    > > Is BagSof1.xls open. It should be.
    > >
    > > Using application.Run is pretty straightforward. I use it all the time

    to
    > > call the functions in the Analysis Toolpak - VBA (as one example).
    > >
    > > --
    > > Regards.
    > > Tom Ogilvy
    > >
    > > "ben" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Application.Run toexp + ".xls!module1.otay", noh, nohl
    > > > is the exact code i am using where
    > > > toexp = "BagSof1" I have ran in break just to be sure the variable is
    > > > assigned correctly.
    > > > and it still does not call the macro, excel hovers over that statement

    > > like
    > > > it's trying to load a workbook or something then skips it with 'on

    error
    > > > resume next' but when i turn it off it gives me an error box that says

    > > only
    > > > '400' with no explination and the help button does nothing
    > > > "Tom Ogilvy" wrote:
    > > >
    > > > > ApplicationRun "workbook1.xls!module1.macro",noh,nohl
    > > > >
    > > > > where noh and noh1 ae the variables holding the values passed.
    > > > >
    > > > > --
    > > > > Regards,
    > > > > Tom Ogilvy
    > > > >
    > > > >
    > > > > "ben" <[email protected]> wrote in message
    > > > > news:[email protected]...
    > > > > > I am trying to call a macro from a seperate workbook than the one

    that
    > > > > called
    > > > > > it, but the sub calling the other sub needs to pass named

    arguments
    > > > > > (noh(),nohl()) but the application.run method does not allow the

    > > passing
    > > > > of
    > > > > > named arguments, it says it they need to be passed by postion. I'm

    not
    > > > > quite
    > > > > > sure what that means, how do I cause that other macro to be open
    > > > > > "workbook1!module1.macro",noh,nohl while passing those arguments
    > > > > (variables)
    > > > > > either with application.run or another syntax?
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >




+ 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