Results 1 to 3 of 3

Passing Arguments

This is a discussion on Passing Arguments within the Excel Questions forums, part of the Question Forums category; I am having a terrible time trying to pass an argument from one workboork to another workbook. I am using ...

  1. #1
    Board Regular
    Join Date
    Jun 2003
    Location
    Rockford, Illinois
    Posts
    466

    Default Passing Arguments

    I am having a terrible time trying to pass an argument from one workboork to another workbook.

    I am using the variable (CLOSE_IT) as a string. I want it to hold the value "YES"

    In workbook #1 I assign the value "YES" in a sub that opens workbook # 2 but when I run a sub in workbook 2 the value is empty.

    I have tried every way i know and everything I read, but it won't work.

    I have tried putting the variable in the parenthess of the first sub..........Sub mysub(CLOSE_IT) but excel won't even accept this and the sub will not run when I do this.

    I have also dimensioned CLOSE_IT as Public.


    Please help.

    An example would really help.


    Thank You Marty
    D1A@aol.com

  2. #2
    MrExcel MVP erik.van.geit's Avatar
    Join Date
    Feb 2003
    Location
    Belgium 3272 Testelt
    Posts
    17,765

    Default Re: Passing Arguments

    This is not really the best answer, but a temporary solution.
    Put your YES in a cell of your workbook #1.

    Excel won't "forget" that !

    regards,
    Erik

  3. #3
    MrExcel MVP
    Moderator
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    25,945

    Default Re: Passing Arguments

    I don't know that you can pass an argument from one Workbook to another. What I would do is put all my VB code in one of the workbooks because you CAN pass arguments from one macro to another in the same Workbook and you CAN run VBA code located in one workbook on another open Workbook.
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com