Continuing this topic IFileOpenDialog and IFileSaveDialog from VBA, I ask some help.
I started from this point: The Open Dialog Box
I called
CoInitializeEx()
to initialize the COM library as described above.I called
CoCreateInstance()
to create the Common Item Dialog object and get a pointer to the object'sIFileOpenDialog
interface.Next I need to "Call the object's Show method", which shows the dialog box to the user.
Can anyone advise me how it can to be made?
Declare Function CoInitializeEx Lib "ole32" (ByVal pRef As Long, ByVal dwCoInit As Long) As Long
Declare Function CoUninitialize Lib "ole32" () As Long
Declare Function CoCreateInstance Lib "ole32" (ByVal CLSID As String, _
ByVal pUnkOuter As Long, _
ByVal dwClsContext As Long, _
ByVal riid As String, _
ByVal ppv As Long) As Long
Const CLSID_FileOpenDialog As String = "D57C7288-D4AD-4768-BE02-9D969532D960"
Const CLSCTX_INPROC_SERVER = &H1
Sub iniComLibr()
Dim pRef As Long, hComLibr As Long, hObjInt As Long, dwCoInit As Long, oFileOpenDialog As Object
hComLibr = CoInitializeEx(pRef, dwCoInit) 'activate a COM_library and get the handle
Dim pUnkOuter As Long, dwClsContext As Long, riid As String, ppv As Long
ppv = VarPtr(riid)
hObjInt = CoCreateInstance(CLSID_FileOpenDialog, 0, CLSCTX_INPROC_SERVER, riid, ppv) 'get the pointer to the object's IFileOpenDialog interface
' here I need call Show method, but don't know how....
hComLibr = CoUninitialize() 'This is mandatory balance after CoInitializeEx
'call was made.
End Sub