Sub toOpenF()
filename = Application _
.GetOpenFilename("Text Files (*.xl*), *.xl*")
If filename <> False Then
MsgBox "Open " & fileToOpen
End If
If Not IsEmpty(filename) Then
Set wb = Workbooks.Open(filename, False, False)
Else
Exit Sub
End If
For Each sh In wb.Worksheets
sh.Copy before:=ThisWorkbook.Sheets(sh.Name)
Next
wb.Close
Set wb = Nothing
End Sub |
Sub toOpenF()
filename = Application _
.GetOpenFilename("Text Files (*.xl*), *.xl*")
If filename <> False Then
MsgBox "Open " & fileToOpen
End If
If Not IsEmpty(filename) Then
Set wb = Workbooks.Open(filename, False, False)
Else
Exit Sub
End If
For Each sh In wb.Worksheets
sh.Copy before:=ThisWorkbook.Sheets(sh.Name)
Next
wb.Close
Set wb = Nothing
End Sub