+ Reply to Thread
Results 1 to 5 of 5

Passing Variable from one sub to another

  1. #1
    Registered User
    Join Date
    05-21-2014
    Posts
    30

    Passing Variable from one sub to another

    Hi,
    I want to know are there anyway I can passing variable or string from one sub to another sub or include them.

    from example,
    Please Login or Register  to view this content.
    I want the string to pass to the main()

    Please Login or Register  to view this content.
    are there include(getConfig) ???? something like that?

  2. #2
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Passing Variable from one sub to another

    make the variables public

    declare them like:
    Please Login or Register  to view this content.
    before any sub. that way they don't get cleared while leaving the first sub
    If you think that my answer was helpful, please click on the "Add to this user's Reputation" button.

  3. #3
    Registered User
    Join Date
    05-21-2014
    Posts
    30

    Re: Passing Variable from one sub to another

    Can you show a bit more example? where do I declare them?

    Please Login or Register  to view this content.
    If I have sub in different modules, are there anyway to pass the string between modules?
    Last edited by bbmak; 07-26-2014 at 02:37 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Passing Variable from one sub to another

    these are the two options you'd have to do that:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-21-2014
    Posts
    30

    Re: Passing Variable from one sub to another

    thx for the example.
    So there are no easy way to do it like include("string"), every time I start a module I have to put that on top.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. passing variable name...
    By zara_toustra in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-18-2013, 01:15 PM
  2. Passing a variable from one sub to another sub
    By NRMDU in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2013, 04:45 PM
  3. Passing Variable to Macro
    By Mota in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-09-2010, 07:35 PM
  4. passing variable?
    By leroiv in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-06-2008, 10:52 AM
  5. [SOLVED] Passing variable to VarType of other Variable
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2005, 10:06 AM

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