View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default Import two worksheets into workbook

I always use code lke this to have the user select a file (without actually
opening the file yet).

Dim Fyle1 As String
'The user needs to select the file from which data should be retrieved.
'GetOpenFilename displays a standard File Open dialog, but it only gets
'the file name - it doesn't open the file.
Fyle1$ = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
'If no file was selected (Cancel clicked), stop the macro.
If Fyle1$ = "False" Then Exit Sub

'Open the selected workbook.
Workbooks.Open Filename:=Fyle1$

Hope this helps,

Hutch

"dan" wrote:

Hi,

I would like to run a macro which will work like this:

MsgBox "Select file 1"
- Import data dialog box to allow user to select an excel file
MsgBox "Select file 2"
- Import data dialog box to allow user to select an excel file

I dont want to define the path or filename, but want the user to be
able to select the file to import.

Thank you ahead of time for your help!!!!

Dan