Excelnoobisme
Board Regular
- Joined
- Nov 19, 2010
- Messages
- 128
i have come across the following code to open folder.....
Sub OpenSingleFile()
Dim Filter As String, Title As String
Dim FilterIndex As Integer
Dim Filename As Variant
Filter = "Excel 97-03 (*.xls),*.xls," & _
"Excel 07 (*.xlsx),*.xlsx," & _
"Excel Marco-Enabled (*.xlsm),*.xlsm," & _
"Text Files (*.txt),*.txt," & _
"All Files (*.*),*.*"
FilterIndex = 3
Title = "Select a File to Open"
ChDrive ("S")
ChDir ("S:\Casino Control\Gaming Audit\Slots\Net win vs Mtr win Variance\2011\Net Win vs Meter Win\Aug")
With Application
Filename = .GetOpenFilename(Filter, FilterIndex, Title)
ChDrive (Left(.DefaultFilePath, 1))
ChDir (.DefaultFilePath)
End With
If Filename = False Then
MsgBox "No file was selected."
Exit Sub
End If
Workbooks.Open Filename
End Sub
On the filter which i bold, what is the command to show all excel files, be it .xls, xlsx or xlsm?
Sub OpenSingleFile()
Dim Filter As String, Title As String
Dim FilterIndex As Integer
Dim Filename As Variant
Filter = "Excel 97-03 (*.xls),*.xls," & _
"Excel 07 (*.xlsx),*.xlsx," & _
"Excel Marco-Enabled (*.xlsm),*.xlsm," & _
"Text Files (*.txt),*.txt," & _
"All Files (*.*),*.*"
FilterIndex = 3
Title = "Select a File to Open"
ChDrive ("S")
ChDir ("S:\Casino Control\Gaming Audit\Slots\Net win vs Mtr win Variance\2011\Net Win vs Meter Win\Aug")
With Application
Filename = .GetOpenFilename(Filter, FilterIndex, Title)
ChDrive (Left(.DefaultFilePath, 1))
ChDir (.DefaultFilePath)
End With
If Filename = False Then
MsgBox "No file was selected."
Exit Sub
End If
Workbooks.Open Filename
End Sub
On the filter which i bold, what is the command to show all excel files, be it .xls, xlsx or xlsm?