From any code window, choose References from the Tools menu.
Check the box beside the MS Common Dialog library.
If it is not there, it may not be correctly registered.
Quite honestly, it's not worth messing with that thing. It's buggy, and
prone to versioning problems. Better to just ignore it, and use the API
calls instead. This link explains how to do that for the File Open/Save
dialog:
http://www.mvps.org/access/api/api0001.htm
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"deko" <dje422@hotmail.com> wrote in message
news:vhXzb.32848$4W6.2586@newssvr29.news.prodigy.c om...[color=blue]
> I need to use the Common Dialog box, but I'm having trouble getting[/color]
started.[color=blue]
> Bear with me as this is new ground for me...
>
> First, I get an error trying to declare these functions -- compile error:
> User-defined type not defined - am I missing a reference? which one?
>
> Private Declare Function GetOpenFileName _
> Lib "COMDLG32.DLL" Alias "GetOpenFileNameA" _
> (pOpenfilename As OPENFILENAME) As Long
> Private Declare Function GetSaveFileName _
> Lib "COMDLG32.DLL" Alias "GetSaveFileNameA" _
> (pOpenfilename As OPENFILENAME) As Long
> Private Declare Function GetActiveWindow _
> Lib "user32" () As Long
>
>
> Then, how do I use this code (below)? Do I simply create a
> cmdGetFileFromAPI_Click command button on my form?
> Do I need anything else in order to launch the Common Dialog Box?
>
> Sub GetFileFromAPI()
> Dim OFN As OPENFILENAME
> With OFN
> .lStructSize = Len(OFN) ' Size of structure.
> .nMaxFile = 260 ' Size of buffer.
> ' Create buffer.
> .lpstrFile = String(.nMaxFile - 1, 0)
> Ret = GetOpenFileName(OFN) ' Call function.
> If Ret <> 0 Then ' Non-zero is success.
> ' Find first null char.
> n = InStr(.lpstrFile, vbNullChar)
> ' Return what's before it.
> MsgBox Left(.lpstrFile, n - 1)
> End If
> End With
> End Sub
>
>[/color]