MarcGraff
asked on
CreateObject("MSComDlg.CommonDialog")???
Dim ImportTbl
Set ImportTbl= CreateObject("MSComDlg.Com monDialog" )
on the "Set ImportTbl= CreateObject("MSComDlg.Com monDialog" )" line it gives an error stating:
Run-time error '429':
ActiveX component can't create object
This code works on my computer but not on others. I have installed the VB6 Runtime package but that did nothing.
Any help would be very appreciated.
- Marc
Set ImportTbl= CreateObject("MSComDlg.Com
on the "Set ImportTbl= CreateObject("MSComDlg.Com
Run-time error '429':
ActiveX component can't create object
This code works on my computer but not on others. I have installed the VB6 Runtime package but that did nothing.
Any help would be very appreciated.
- Marc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think You have to set a reference in "Project Components" to "Microsoft CommonDialog Control VB6" (use latest SP # you see listed.)
Then you have to be sure to include the DLL containing this in your project SETUP utility.
Here's some sample code that should work.
========================== ========== ========== ========== ====
Dim oDialog As Object 'Unfortunately, CreateObject( ) does not work if declared "As CommonDialog"
If Len(sFileSpec) = 0 Then
'------------------------- ---------- ---------- -------
'Prompt to save into a UDL file
'------------------------- ---------- ---------- -------
Set oDialog = CreateObject("MSComDlg.Com monDialog. 1")
With oDialog
.InitDir = gsAppPath
.DialogTitle = "Save OLEDB Data Link (.UDL) File."
.DefaultExt = ".udl"
.Filter = "Data Link Files (*.udl) | *.udl"
'.Action = 2 -- This is the same as calling:
.ShowSave
'Processing will return here after the dialog box closes.
sFileSpec = Trim$(.FileName)
If Len(sFileSpec) = 0 Then
'User cancelled.
GoTo CleanUpAndExit 'RETURN FALSE
End If
End With 'oDialog
Set oDialog = Nothing
End If
Then you have to be sure to include the DLL containing this in your project SETUP utility.
Here's some sample code that should work.
==========================
Dim oDialog As Object 'Unfortunately, CreateObject( ) does not work if declared "As CommonDialog"
If Len(sFileSpec) = 0 Then
'-------------------------
'Prompt to save into a UDL file
'-------------------------
Set oDialog = CreateObject("MSComDlg.Com
With oDialog
.InitDir = gsAppPath
.DialogTitle = "Save OLEDB Data Link (.UDL) File."
.DefaultExt = ".udl"
.Filter = "Data Link Files (*.udl) | *.udl"
'.Action = 2 -- This is the same as calling:
.ShowSave
'Processing will return here after the dialog box closes.
sFileSpec = Trim$(.FileName)
If Len(sFileSpec) = 0 Then
'User cancelled.
GoTo CleanUpAndExit 'RETURN FALSE
End If
End With 'oDialog
Set oDialog = Nothing
End If
ASKER
- Marc