Hey all,
I'm running Excel for Mac 2011, VBA 14.1.4.
I'm trying to use the GetOpenFilename method and have realized that if I use any arguments I get Runtime Error 1004 'Method GetOpenFilename of Object '_Application" failed'
The code that fails is:
Sub Test()
'Dimension variables for the Macro Initiate worksheet
Dim ALName As Variant
Dim FilterIndex As Integer
Dim Filter As String, Title As String
Windows("Machine Reconcilliation Macro.xls").Activate
'Set RowVar = Sheets("MacroInitiate").Range("d2")
'Do Until RowVar.Value = ""
'ALName = List of specific call center's Agents exported from console as .CSV
Filter = "CSV Files (*.csv),*.csv"
FilterIndex = 1
Title = "Open CSV file of Call Center's Agents Exported from console"
With Application
ALName = .GetOpenFilename(Filter, FilterIndex, Title)
'ALName = .GetOpenFilename()
End With
' Exit on Cancel
If ALName = False Then
MsgBox "No file was selected."
Exit Sub
Else
Workbooks.Open Filename:=ALName
End If
MsgBox "File Opened."
End Sub
The code that works simply alternates the comment of the "ALName = " lines.
Any ideas?
Thanks,
-E
I'm running Excel for Mac 2011, VBA 14.1.4.
I'm trying to use the GetOpenFilename method and have realized that if I use any arguments I get Runtime Error 1004 'Method GetOpenFilename of Object '_Application" failed'
The code that fails is:
Sub Test()
'Dimension variables for the Macro Initiate worksheet
Dim ALName As Variant
Dim FilterIndex As Integer
Dim Filter As String, Title As String
Windows("Machine Reconcilliation Macro.xls").Activate
'Set RowVar = Sheets("MacroInitiate").Range("d2")
'Do Until RowVar.Value = ""
'ALName = List of specific call center's Agents exported from console as .CSV
Filter = "CSV Files (*.csv),*.csv"
FilterIndex = 1
Title = "Open CSV file of Call Center's Agents Exported from console"
With Application
ALName = .GetOpenFilename(Filter, FilterIndex, Title)
'ALName = .GetOpenFilename()
End With
' Exit on Cancel
If ALName = False Then
MsgBox "No file was selected."
Exit Sub
Else
Workbooks.Open Filename:=ALName
End If
MsgBox "File Opened."
End Sub
The code that works simply alternates the comment of the "ALName = " lines.
Any ideas?
Thanks,
-E