yazbek
asked on
Problem with adding common dialog box control. "You don't have the license required to use this ActiveX Control"
When I try to add the Microsoft ActiveX control - Common Dialog (Comdlg32.ocx) the message appears:
"You don't have the license required to use this ActiveX control"
I have registered the control and the message still appears.
I have MS Access XP and MS Access 2007 installed.
Is there are away to have the common dialog appear in MS Access without using the ActiveX control.
Ultimately, I need to be able to select files from the common dialog box and insert the files and their path to a text box control on a form.
Thank you.
"You don't have the license required to use this ActiveX control"
I have registered the control and the message still appears.
I have MS Access XP and MS Access 2007 installed.
Is there are away to have the common dialog appear in MS Access without using the ActiveX control.
Ultimately, I need to be able to select files from the common dialog box and insert the files and their path to a text box control on a form.
Thank you.
or try http://support.microsoft.com/kb/172859/EN-US
to debug the control
to debug the control
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Koutny,
Thank you for your response - that sounds like what I'm looking for. I have one query and please excuse my ignorance.
The following lines are not recognised as VBA code. Could you please shed some light on this problem please!!! I am using an MS Access 2002 MDB file in MS Access 2007.
VERSION 1.0 CLASS
Begin
MultiUse = -1 'True
End
Attribute VB_Name = "CommonDialogWrapper"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Thank you for your response - that sounds like what I'm looking for. I have one query and please excuse my ignorance.
The following lines are not recognised as VBA code. Could you please shed some light on this problem please!!! I am using an MS Access 2002 MDB file in MS Access 2007.
VERSION 1.0 CLASS
Begin
MultiUse = -1 'True
End
Attribute VB_Name = "CommonDialogWrapper"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
ASKER
I have found the solution - Thanks to all for your assistance:
'Place the following in a form
Private Sub cmdFind_Click()
FileToOpen
End Sub
Function FileToOpen(Optional StartLookIn) As String
Dim OFN As gFILE
Dim path As String
Dim FileName As String
Dim a As String
StartOver:
OFN.lStructSize = Len(OFN)
OFN.lpstrFilter = "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
OFN.lpstrFile = Space$(254)
OFN.nMaxFile = 255
OFN.lpstrFileTitle = Space$(254)
OFN.nMaxFileTitle = 255
If Not IsMissing(StartLookIn) Then
OFN.lpstrInitialDir = StartLookIn
'Else
' OFN.lpstrInitialDir = "C:\CorelDrw Files"
End If
OFN.lpstrTitle = "Please find and select the Excel File"
OFN.Flags = 0
a = GetOpenFileName(OFN)
If (a) Then
path = Trim(OFN.lpstrFile)
FileName = Trim(OFN.lpstrFileTitle)
If Dir(path) <> "" Then FileToOpen = -1
FileToOpen = Trim(OFN.lpstrFile)
Me.FileName = FileToOpen
Else
FileToOpen = ""
path = ""
FileName = ""
End If
'_________________________ __________ ________
'Place the following in a module
Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As gFILE) As Long
Type gFILE
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
'Place the following in a form
Private Sub cmdFind_Click()
FileToOpen
End Sub
Function FileToOpen(Optional StartLookIn) As String
Dim OFN As gFILE
Dim path As String
Dim FileName As String
Dim a As String
StartOver:
OFN.lStructSize = Len(OFN)
OFN.lpstrFilter = "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
OFN.lpstrFile = Space$(254)
OFN.nMaxFile = 255
OFN.lpstrFileTitle = Space$(254)
OFN.nMaxFileTitle = 255
If Not IsMissing(StartLookIn) Then
OFN.lpstrInitialDir = StartLookIn
'Else
' OFN.lpstrInitialDir = "C:\CorelDrw Files"
End If
OFN.lpstrTitle = "Please find and select the Excel File"
OFN.Flags = 0
a = GetOpenFileName(OFN)
If (a) Then
path = Trim(OFN.lpstrFile)
FileName = Trim(OFN.lpstrFileTitle)
If Dir(path) <> "" Then FileToOpen = -1
FileToOpen = Trim(OFN.lpstrFile)
Me.FileName = FileToOpen
Else
FileToOpen = ""
path = ""
FileName = ""
End If
'_________________________
'Place the following in a module
Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As gFILE) As Long
Type gFILE
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
yes you can using windows api call but i can't remember the exact declaration (i'm sure its
Comdlg32.dll) so i'll have to dig up one of my old apps from years ago when i get home.
i get blocked at work from below site but try :
www.pisarsky.com/software/source/vb6/cdlg.html