![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
MrExcel MVP, Administrator
Join Date: Feb 2002
Location: The act or process of locating.
Posts: 13,679
|
I currently have a script set to open 2 specific workbooks and then prompt to choose the required 3rd.
As it is, I can only select 1 when the 'open' window comes up. Is there any way I can make this so I am able to select more than one file at once? The code I currently have is as follows: Quote:
"What am I, a magnet for these idiots?" --Pearl Forrester, MST3K [ This Message was edited by: Von Pookie on 2002-02-20 14:01 ] |
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
You just need to set the Multiselect argument to True e.g.
Which = Application.GetOpenFilename(MultiSelect:=True) 'Which now contains an array of file names which you can enumerate through For l = 1 To UBound(Which) MsgBox Which(l) Next HTH, D |
|
|
|
|
|
#3 |
|
MrExcel MVP, Administrator
Join Date: Feb 2002
Location: The act or process of locating.
Posts: 13,679
|
This does let me select more than one file, however, it will not open them. The only thing that happens when I click 'open' is that I get a message box that tells me the files I selected.
I tried deleting the "MsgBox Which(l)" line, however then it doesn't do anything... |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Quote:
Workbooks.Open Which (l) where that "Msgbox Which(l)" was before. |
|
|
|
|
|
|
#5 | |
|
MrExcel MVP, Administrator
Join Date: Feb 2002
Location: The act or process of locating.
Posts: 13,679
|
Quote:
This is what I'm working with now: Code:
Private Sub Workbook_Open() On Error GoTo myErr ChDir "(dir)" Workbooks.Open "(file).xls" Workbooks.Open "(file).xls" Which = Application.GetOpenFilename(MultiSelect:=True) 'Which now contains an array of file names which you can enumerate through For l = 1 To UBound(Which) Workbooks.Open Which (l) Next Workbooks.Open Which End myErr: End Sub "What am I, a magnet for these idiots?" --Pearl Forrester, MST3K [ This Message was edited by: Von Pookie on 2002-02-21 09:26 ] |
|
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
Try this:
Code:
Private Sub Workbook_Open() On Error GoTo myErr ChDir "C:Documents and SettingsksharpeDesktopECR" Workbooks.Open "C:Documents and SettingsksharpeDesktopECRUPGUPG List Revised.xls" Workbooks.Open "C:Documents and SettingsksharpeDesktopECRMain Directory.xls" Which = Application.GetOpenFilename(MultiSelect:=True) 'Which now contains an array of file names which you can enumerate through For I = 1 To UBound(Which) Workbooks.Open Which(I) Next End myErr: End Sub [ This Message was edited by: Russell Hauf on 2002-02-21 09:27 ] |
|
|
|
|
|
#7 |
|
MrExcel MVP, Administrator
Join Date: Feb 2002
Location: The act or process of locating.
Posts: 13,679
|
That seemed to do the trick.
Thanks! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|