LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Import through dialogbox

I found this program to import many worksheets from different location.
1. How can I change it to stop after one choice ?
2. How can I change it to stop after two choice ?


Sub GetSheets()

Dim s As String

Dim fd As FileDialog
Dim ffs As FileDialogFilters
Dim wb As Workbook
Dim xb As Workbook
Set xb = ActiveWorkbook

'Get user to pick file
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
Set ffs = .Filters
With ffs
..Clear
..Add "Excel Files", "*.xls"
End With
..AllowMultiSelect = False
If .Show Then s = .SelectedItems(1)
End With

'Turn off prompts
Application.DisplayAlerts = False

'Open chosen workbook
Set wb = Workbooks.Open(s, False)

Dim ws As Worksheet
For Each ws In wb.Worksheets
ws.Copy xb.Worksheets(1)
Next ws


'Close workbook
wb.Close

'Switch prompts back on
Application.DisplayAlerts = True

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
reactivate DialogBox oldLearner57 Excel Discussion (Misc queries) 1 September 15th 08 01:02 AM
Open DialogBox in VBA schoujar[_16_] Excel Programming 5 November 4th 05 03:36 AM
DialogBox Layout Patrick Simonds Excel Programming 2 October 1st 05 09:35 PM
OpenFile dialogbox Manu Palao Excel Worksheet Functions 1 November 24th 04 04:27 PM
DialogBox Greg[_12_] Excel Programming 2 September 17th 03 01:41 AM


All times are GMT +1. The time now is 07:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"