T
tobesurveyor via AccessMonster.com
Is there a difference between a form's class module and just a class module?
I am using this code found under the www.mvps.com to choose a folder. I
placed the code under a new class module and when I went to compile it, it
gives me an error stating "Method or data member not found"
Any Help would be great. Thanks,
Chris
Here is the code...
Public Function BrowseForFolderByPath(sSelPath As String) As String
Dim BI As BROWSEINFO
Dim pidl As Long
Dim lpSelPath As Long
Dim spath As String * MAX_PATH
With BI
.hOwner = Me.hwnd
.pidlRoot = 0
.lpszTitle = "Select Folder..."
.lpfn = FARPROCl(AddressOf BrowseCallbackProcStr)
lpSelPath = LocalAlloc(LPTR, Len(sSelPath) + 1)
CopyMemory ByVal lpSelPath, ByVal sSelPath, Len(sSelPath) + 1
.lParam = lpSelPath
End With
pidl = SHBrowseForFolder(BI)
If pidl Then
If SHGetPathFromIDList(pidl, spath) Then
BrowseForFolderByPath = Left$(spath, InStr(spath, vbNullChar) - 1)
End If
Call CoTaskMemFree(pidl)
End If
Call LocalFree(lpSelPath)
End Function
I am using this code found under the www.mvps.com to choose a folder. I
placed the code under a new class module and when I went to compile it, it
gives me an error stating "Method or data member not found"
Any Help would be great. Thanks,
Chris
Here is the code...
Public Function BrowseForFolderByPath(sSelPath As String) As String
Dim BI As BROWSEINFO
Dim pidl As Long
Dim lpSelPath As Long
Dim spath As String * MAX_PATH
With BI
.hOwner = Me.hwnd
.pidlRoot = 0
.lpszTitle = "Select Folder..."
.lpfn = FARPROCl(AddressOf BrowseCallbackProcStr)
lpSelPath = LocalAlloc(LPTR, Len(sSelPath) + 1)
CopyMemory ByVal lpSelPath, ByVal sSelPath, Len(sSelPath) + 1
.lParam = lpSelPath
End With
pidl = SHBrowseForFolder(BI)
If pidl Then
If SHGetPathFromIDList(pidl, spath) Then
BrowseForFolderByPath = Left$(spath, InStr(spath, vbNullChar) - 1)
End If
Call CoTaskMemFree(pidl)
End If
Call LocalFree(lpSelPath)
End Function