WineSnob
Not Bright but TENACIOUS
- Local time
- Today, 17:44
- Joined
- Aug 9, 2010
- Messages
- 211
I am getting an error: "Object doesn't support the property or method"
using the following very reliable code.
It errors on CDlg1.DialogTitle = "Select File in Folder"
The only difference now is I am using a Win 7 64bit. I added Comdlg32.ocx to the WOW64 folder and registered it. It is in the References OK.
Private Sub cmdBrowse_Click()
Dim fileflags As FileOpenConstants
Dim filefilter As String
Dim sPath As String
'Set the text in the dialog title bar
CDlg1.DialogTitle = "Select File in Folder"
'Set the default file name and filter
CDlg1.DefaultExt = "xls*"
CDlg1.InitDir = "\"
CDlg1.filename = ""
filefilter = "*.xls"
CDlg1.Filter = filefilter
CDlg1.FilterIndex = 0
'Prompt to create the file if it does not exist
'and prompt to overwrite if the file exists
fileflags = cdlOFNCreatePrompt + cdlOFNOverwritePrompt
CDlg1.Flags = fileflags
'Show the Save As common dialog box
CDlg1.ShowOpen
'Return the path and file name selected or
'Return an empty string if the user cancels the dialog
sPath = CDlg1.filename
If sPath <> "" Then
txtImportPath = GetFolder(sPath)
UpdateSettings
End If
End Sub
using the following very reliable code.
It errors on CDlg1.DialogTitle = "Select File in Folder"
The only difference now is I am using a Win 7 64bit. I added Comdlg32.ocx to the WOW64 folder and registered it. It is in the References OK.
Private Sub cmdBrowse_Click()
Dim fileflags As FileOpenConstants
Dim filefilter As String
Dim sPath As String
'Set the text in the dialog title bar
CDlg1.DialogTitle = "Select File in Folder"
'Set the default file name and filter
CDlg1.DefaultExt = "xls*"
CDlg1.InitDir = "\"
CDlg1.filename = ""
filefilter = "*.xls"
CDlg1.Filter = filefilter
CDlg1.FilterIndex = 0
'Prompt to create the file if it does not exist
'and prompt to overwrite if the file exists
fileflags = cdlOFNCreatePrompt + cdlOFNOverwritePrompt
CDlg1.Flags = fileflags
'Show the Save As common dialog box
CDlg1.ShowOpen
'Return the path and file name selected or
'Return an empty string if the user cancels the dialog
sPath = CDlg1.filename
If sPath <> "" Then
txtImportPath = GetFolder(sPath)
UpdateSettings
End If
End Sub