Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default GetOpenFilename

I want the user to open multiple Excel files at once (if
possible, all files in a specific directory.

Since my code is in access, I'm using the following method:
Excel.Application.GetOpenFilename("XLS (*.xls),
*.xls", , "Open All Files Here", , True)

I know that since multiple select is true, this code will
return an array with all of the file names. I just don't
know how to assign a reference to this array so that I can
open all of the workbooks.

TIA
Chodu
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default GetOpenFilename

Hi Chodu,

Here's an example of one way to make this work.

Sub OpenMultipleFiles()
Dim vaFileNames As Variant
Dim vItem As Variant
vaFileNames = Excel.Application.GetOpenFilename( _
"XLS (*.xls), *.xls", , "Open All Files Here", , True)
' If the result is not an array the user cancelled
' the dialog.
If IsArray(vaFileNames) Then
For Each vItem In vaFileNames
Excel.Application.Workbooks.Open vItem
Next vItem
End If
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Chodu" wrote in message
...
I want the user to open multiple Excel files at once (if
possible, all files in a specific directory.

Since my code is in access, I'm using the following method:
Excel.Application.GetOpenFilename("XLS (*.xls),
*.xls", , "Open All Files Here", , True)

I know that since multiple select is true, this code will
return an array with all of the file names. I just don't
know how to assign a reference to this array so that I can
open all of the workbooks.

TIA
Chodu



Reply
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
GetOpenFilename Todd Htutenstine Excel Programming 2 May 13th 04 03:14 PM
GetOpenFilename Greg Bloom Excel Programming 0 February 9th 04 03:32 PM
GetOpenFilename Wolfgang Excel Programming 1 February 6th 04 07:37 PM
getopenfilename inquirer Excel Programming 1 December 3rd 03 11:37 AM
GetOpenFilename Hasan Cansü Excel Programming 0 September 24th 03 01:32 PM


All times are GMT +1. The time now is 03:06 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"