D
David
Hi Excellers
I have read several posts on the Cancel event using the
GetOpenFileName method. What has been posted "seemed" OK for the
examples shown but I am having other difficulties. I get Error 13
"Type Mismatch". The type mismatch occurs when the user selects a
file giving strFile a string path. The problem occurs when the code
goes to the If statement and tries to evaluate strFile. It is
expecting a boolean vaue but gets a string => error!
My code is:
Private Sub cmdStart_Click()
Dim strFile As String
strFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls", ,
"Open strFile.xls file")
If strFile = False Then
'User has cancelled
MsgBox "Data Update Cancelled", vbInformation, "DATA UPDATING"
Exit Sub
End If
MsgBox "All code has worked"
End Sub
'As always, your help is much appreciated.
I have read several posts on the Cancel event using the
GetOpenFileName method. What has been posted "seemed" OK for the
examples shown but I am having other difficulties. I get Error 13
"Type Mismatch". The type mismatch occurs when the user selects a
file giving strFile a string path. The problem occurs when the code
goes to the If statement and tries to evaluate strFile. It is
expecting a boolean vaue but gets a string => error!
My code is:
Private Sub cmdStart_Click()
Dim strFile As String
strFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls", ,
"Open strFile.xls file")
If strFile = False Then
'User has cancelled
MsgBox "Data Update Cancelled", vbInformation, "DATA UPDATING"
Exit Sub
End If
MsgBox "All code has worked"
End Sub
'As always, your help is much appreciated.