Results 1 to 1 of 1

Create dialog box for Excel

Threaded View

  1. #1
    Registered User
    Join Date
    07-14-2014
    Location
    Stamford, CT
    MS-Off Ver
    2007
    Posts
    16

    Create dialog box for Excel

    When I create a button and apply the following code to the button, the button successfully uploads the file to my worksheet. However, if I had three files that I wanted to upload on the form (three browse buttons), how would I code each button, so that after a file was selected for upload, it would be held in queue until I press an "OK" button at the bottom of the form.

    
    Private Sub CommandButton1_Click()
    Dim wb1 As Workbook
    Dim wb2 As Workbook
    Dim Sheet As Worksheet
    Dim PasteStart As Range
    
    Set wb1 = ActiveWorkbook
    
    'Set Sheet Name
    Set PasteStart = [NAME!A1]
    
    FileToOpen = Application.GetOpenFilename _
    (Title:="Please choose a Report to Parse", _
    FileFilter:="Report Files *.xls (*.xls),")
    
    If FileToOpen = False Then
        MsgBox "No File Specified.", vbExclamation, "ERROR"
        Exit Sub
    Else
        Set wb2 = Workbooks.Open(Filename:=FileToOpen)
        
           For Each Sheet In wb2.Sheets
            With Sheet.UsedRange
                .Copy PasteStart
                Set PasteStart = PasteStart.Offset(.Rows.Count)
            End With
        Next Sheet
    
    End If
    
        wb2.Close
    
     
    End Sub
    Last edited by KG23; 08-06-2015 at 01:50 PM. Reason: Progress

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to create a User input dialog box?
    By gshock in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-14-2008, 01:21 PM
  2. How to create dialog box?
    By TomT in forum Excel General
    Replies: 3
    Last Post: 04-05-2008, 04:34 PM
  3. how to create a dialog sheet in microsoft excel
    By bharat in forum Excel General
    Replies: 1
    Last Post: 01-23-2006, 05:30 AM
  4. [SOLVED] Create a dialog box
    By Raza in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-02-2005, 02:40 PM
  5. How to create popup dialog messages
    By NYBoy in forum Excel General
    Replies: 2
    Last Post: 10-14-2005, 11:30 AM
  6. [SOLVED] how do i create a dialog box to appear on opening an excel wkbook
    By lallyboo in forum Excel General
    Replies: 1
    Last Post: 10-13-2005, 02:05 PM
  7. How to create dialog boxes
    By ZildjianK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2005, 07:05 PM
  8. Create Startup Dialog
    By coal_miner in forum Excel General
    Replies: 2
    Last Post: 06-08-2005, 03:05 PM

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