+ Reply to Thread
Results 1 to 3 of 3

Functions / Macros - Array question

  1. #1
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Leeds, England
    MS-Off Ver
    MS Office 2007
    Posts
    134

    Functions / Macros - Array question

    Hi everyone!

    I have created a large function, shown below (cut down):

    Please Login or Register  to view this content.
    I then have a macro that runs as:

    Please Login or Register  to view this content.
    How can I make it so that legacy1, and therefore legacy1path is only defined once rather than every time a different CreateExceptions line runs in my macro.

    It probably is simple, but I have become confused.

    Thanks!
    dvent

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon dvent

    You will need to take the file picker routine out of the function, and perhaps put it into the Exceptions macro. This will then run when the macro is run, not when the function is called.

    You will also need to share the legacy1path variable between the two macros. To do this take the dim statement out of the function, and place it right at the top of the module, so that it comes before either of the procedures, but not in either of them. They should both be able to access this variable without a problem.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Leeds, England
    MS-Off Ver
    MS Office 2007
    Posts
    134
    Quote Originally Posted by dominicb
    Good afternoon dvent

    You will need to take the file picker routine out of the function, and perhaps put it into the Exceptions macro. This will then run when the macro is run, not when the function is called.

    You will also need to share the legacy1path variable between the two macros. To do this take the dim statement out of the function, and place it right at the top of the module, so that it comes before either of the procedures, but not in either of them. They should both be able to access this variable without a problem.

    HTH

    DominicB
    Thanks DominicB. Works as described.

+ 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