+ Reply to Thread
Results 1 to 3 of 3

Choose (open) workbook for actions on user prompt

  1. #1
    Registered User
    Join Date
    03-24-2006
    Posts
    38

    Choose (open) workbook for actions on user prompt

    Hello,

    The headline might not be very descriptive. My question is:
    How can i get excel to recognize or let user choose, which open workbook to process with macro, if this workbook has differing name from time to time.
    The macro now uses the "open" function, to open a workbook of choice and then perform actions, however i i want a different action performed(all is in user forms), i must close the workbook again. How can i give the user the option to choose an open workbook/window while in a sort of user form? I do not wish for something where the user has to select a cell in the workbook and then run macro, but rather run userform then select.

    Thank You!

  2. #2
    Ardus Petus
    Guest

    Re: Choose (open) workbook for actions on user prompt

    Create an Userform (UserForm1)
    Add a ListBox (ListBox1)
    Add a Command Button (CommandButton1) with caption "OK"

    Paste the following code in Userform code:

    '------------
    Private Sub CommandButton1_Click()
    MsgBox ListBox1.Value
    End Sub

    Private Sub UserForm_Initialize()
    Dim wb As Workbook
    With ListBox1
    For Each wb In Workbooks
    If wb.Name <> ThisWorkbook.Name Then
    .AddItem (wb.Name)
    End If
    Next wb
    .ListIndex = 1
    End With
    End Sub
    '---------------------

    Et voilà!

    HTH
    --
    AP

    "erikhs" <[email protected]> a écrit dans
    le message de news: [email protected]...
    >
    > Hello,
    >
    > The headline might not be very descriptive. My question is:
    > How can i get excel to recognize or let user choose, which open
    > workbook to process with macro, if this workbook has differing name
    > from time to time.
    > The macro now uses the "open" function, to open a workbook of choice
    > and then perform actions, however i i want a different action
    > performed(all is in user forms), i must close the workbook again. How
    > can i give the user the option to choose an open workbook/window while
    > in a sort of user form? I do not wish for something where the user has
    > to select a cell in the workbook and then run macro, but rather run
    > userform then select.
    >
    > Thank You!
    >
    >
    > --
    > erikhs
    > ------------------------------------------------------------------------
    > erikhs's Profile:
    > http://www.excelforum.com/member.php...o&userid=32788
    > View this thread: http://www.excelforum.com/showthread...hreadid=542427
    >




  3. #3
    Registered User
    Join Date
    03-24-2006
    Posts
    38

    Re

    Thank you!

    I will try this when i get the time.

+ 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