+ Reply to Thread
Results 1 to 3 of 3

Choose and Use Open Workbook from Userform

  1. #1
    Registered User
    Join Date
    06-23-2006
    Location
    Philadelphia, PA
    Posts
    12

    Choose and Use Open Workbook from Userform

    Hello All,

    For the first time, I'm using userforms and multiple workbooks. I want to use a userform to list the open workbooks, then capture the choice so I can perform actions on that workbook (like get data from it). I have the list, but I can't store or use the choice correctly! Code snippets are below. So close, yet so far!


    Please Login or Register  to view this content.
    The userform seems to store just the name of the workbook, as a string. If I set varSourceBook as a String I can get the name, but it's useless because I can't reference it as a workbook. If I set varSourceBook as a workbook, I can't even assign the variant from the userform to it, and thus can't use it.

    (As a bonus question: is this the right structure to be using? I plan to have a workbook that has nothing but the VBA program in it, and the userform will have you choose which open workbook you want it to get the source data from. The program will then create and save a new output workbook.)

    Any help would be greatly appreciated!

    Thanks,
    Alex

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Alex

    Try

    Please Login or Register  to view this content.
    The global variable varSourceBook can now be used in other module macros.


    HTH

    rylo

  3. #3
    Registered User
    Join Date
    06-23-2006
    Location
    Philadelphia, PA
    Posts
    12

    Smile

    Perfect, thanks rylo!

+ 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