Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 5th, 2013, 03:29 PM
Registered User
Join Date: Apr 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Macro Open to worksheet in current Workbook

Hi all,

I scoured the forums and google looking for an answer so I hope this isn't overly simple-

I'm writing a macro where the user is prompted with an open file dialog box. My problem is, after the user selects the file it opens in a new workbook. I need to prompt the user multiple times to open files, but I'd like all the files to appear in the same (current) workbook as tabs (worksheets). I'd appreciate any feedback.

Workbooks.Open filename:=Application.GetOpenFilename

Workbooks.Open filename:=Application.GetOpenFilename

etc. all to be opened in same workbook as worksheets?
Old April 12th, 2013, 02:42 PM
Registered User
Join Date: Feb 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

Use this code to multi-select workbooks to open

Sub MultiSelectWorkbooks()


    Dim GetFile As Variant

    GetFile = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls), *.xls", Title:="Open The Workbook", MultiSelect:=True)


    On Error Resume Next

    If GetFile <> False Then

        On Error GoTo 0


        For i = 1 To UBound(GetFile)

            Workbooks.Open Filename:=GetFile(i)

        Next i

    End If


End Sub
You can't open a workbook into an existing workbook worksheet

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy worksheet to another workbook and rename it Probleminfinity Excel VBA 1 August 19th, 2007 11:38 PM
Copy Worksheet into another workbook money Excel VBA 4 March 8th, 2007 05:17 AM
Copy a worksheet range to a new workbook cej2583 Excel VBA 2 March 14th, 2006 11:55 PM
Find Unknown Worksheet Names in an Excel Workbook bcarmen VB.NET 2002/2003 Basics 1 March 3rd, 2005 12:20 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.