Consulting

Results 1 to 4 of 4

Thread: Open a workbook without knowing it's name.

  1. #1
    VBAX Regular TButhe's Avatar
    Joined
    Sep 2004
    Location
    Sioux Falls, SD
    Posts
    64
    Location

    Open a workbook without knowing it's name.

    Here's what I would like to do -
    I have an old version of a form and I need to create a button on my new form that would open a dialog box and allow the user to browse to their workbook and open it. Then I will copy the data from the old workbook and paste it to the new one. The copying and pasting I can handle, its the opening of the old workbook that i need help with. I have no way on knowing what they have named there OLD workbook. I know there has to be a way to do this. Any ideas and suggestions are appreciated!!


    Thanks!! This is driving me !!

  2. #2
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Hi there!

    I'd make use of the GetOpenFilename method. An example can be found here ..

    http://www.vbaexpress.com/forum/show...etOpenFilename

    Or might look like this ...
    Sub foo()
        Dim fName As String, wb As Workbook
        fName = Application.GetOpenFilename("Excel Target Files (*.xls), *.xls")
        If TypeName(fName) = "Boolean" Then Exit Sub
        Set wb = Workbooks.Open(fName)
        'other code here
    End Sub

  3. #3
    VBAX Regular TButhe's Avatar
    Joined
    Sep 2004
    Location
    Sioux Falls, SD
    Posts
    64
    Location

    That is exactly what I need

    THANKS, I knew you could help me firefytr. You are the best!!

    Can't believe I missed the other post. But, hey the eyes (and brain) aren't what they used to be.

    Thanks again!
    Tracy


    I'm going to mark this closed for now and try to get rest of the process on my own but don't be surprised if this comes up again.

  4. #4
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    You're welcome Tracy! I'm happy to help!!

    If you have any other questions about this, don't hesitate to post back. (And the other post was a little easier for me to find, as it was one I'd subscribed to! )

Posting Permissions

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