PDA

View Full Version : Solved: Macro.



Pinokkio
02-15-2010, 07:48 AM
Can this macro adjust for the new extensions off Excel 2007 (xlsx and xlsm).





Sub Select_Open_Files()
Dim vaFiles As Variant
Dim i As Long
'Change the rpesent Drive to E:
ChDrive ("C")
'Change the present folder.
ChDir "C:\AA"
'Open the built-in customized dialog.
vaFiles = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls),*.xls", Title:="Open files", MultiSelect:=True)
'If the user cancel the operation.
If Not IsArray(vaFiles) Then Exit Sub
'Open the selected file(s).
With Application
.ScreenUpdating = False
For i = 1 To UBound(vaFiles)
Application.Workbooks.Open vaFiles(i)
Next i
.ScreenUpdating = True
End With
End Sub


Thanks in advance.

P.

Bob Phillips
02-15-2010, 07:54 AM
Sub Select_Open_Files()
Dim vaFiles As Variant
Dim i As Long
'Change the rpesent Drive to E:
ChDrive ("C")
'Change the present folder.
ChDir "C:\AA"
'Open the built-in customized dialog.
vaFiles = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*),*.xls*", Title:="Open files", MultiSelect:=True)
'If the user cancel the operation.
If Not IsArray(vaFiles) Then Exit Sub
'Open the selected file(s).
With Application
.ScreenUpdating = False
For i = 1 To UBound(vaFiles)
Application.Workbooks.Open vaFiles(i)
Next i
.ScreenUpdating = True
End With
End Sub

Pinokkio
02-15-2010, 10:37 AM
Thanks again for your help!

P.