+ Reply to Thread
Results 1 to 1 of 1

working on a selected file via GetOpenFilename

  1. #1
    Registered User
    Join Date
    08-16-2005
    Posts
    9

    Question working on a selected file via GetOpenFilename

    Hello, I want to modify the code below to:

    1. Allow the user to browse for a file and select a file

    2. Perform all the steps in a second function on the selected file in #1.

    Naturally step one has to be completed first after which the GetDataFromClosedWorkbook() should run.


    AT the moment they are both running the same time. I am a newbie at in Excel VBA so please pardon me if this is really simple

    Cheers!


    Sub test()
    Dim F As Variant
    F = Application.GetOpenFilename("csv Files (*.csv), *.csv")
    If F = False Then Exit Sub
    Workbooks.Open F
    End Sub

    Sub GetDataFromClosedWorkbook()

    Dim wb As Workbook
    Application.ScreenUpdating = True ' turn off the screen updating
    Set wb = Workbooks.Open("C:\Documents and Settings\user\Desktop\QA Checklists.xls", True, True)
    ' open the source workbook, read only
    With ThisWorkbook.Worksheets("Sheet1")
    ' read data from the source workbook
    .Range("A10").Formula = wb.Worksheets("PM").Range("A10").Formula

    End With
    wb.Close False ' close the source workbook without saving any changes
    Set wb = Nothing ' free memory
    Application.ScreenUpdating = True ' turn on the screen updating
    End Sub
    Last edited by periro16; 09-21-2005 at 09:14 AM.

+ 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