B
Bob Valentine
Group:
I need a function to get the full folder path to the "My Documents" folder.
I am using the function shown below, but it returns a path which is more
than the path to the "My Documents" folder.
This function returns the following path:
"C:\Documents and Settings\Owner\My Documents\Access Documents\My Documents
I do not have a "My Documents" folder in the Access Documents folder on my
computer so I don't know why the function is giving me an incorrect path. I
want the function to return "C:\Documents and Settings\Owner\My Documents"
Any help will be greatly appreciatied. Maybe you have a better function to
find the full path to a folder.
Thanks,
BobV
Here is the function:
Public Function adhFullPath(strName As String) As String
' MAX_PATH is defined by the Windows API.
Const MAX_PATH = 260
Dim lngLen As Long
Dim lngFilled As Long
Dim strBuffer As String
lngLen = MAX_PATH
Do
strBuffer = Space(lngLen)
lngFilled = GetFullPathName( strName, lngLen, strBuffer,
vbNullString)
If lngFilled > lngLen Then
lngLen = lngFilled
End If
Loop Until lngFilled < lngLen
adhFullPath = Left$(strBuffer, lngFilled)
End Function
I need a function to get the full folder path to the "My Documents" folder.
I am using the function shown below, but it returns a path which is more
than the path to the "My Documents" folder.
This function returns the following path:
"C:\Documents and Settings\Owner\My Documents\Access Documents\My Documents
I do not have a "My Documents" folder in the Access Documents folder on my
computer so I don't know why the function is giving me an incorrect path. I
want the function to return "C:\Documents and Settings\Owner\My Documents"
Any help will be greatly appreciatied. Maybe you have a better function to
find the full path to a folder.
Thanks,
BobV
Here is the function:
Public Function adhFullPath(strName As String) As String
' MAX_PATH is defined by the Windows API.
Const MAX_PATH = 260
Dim lngLen As Long
Dim lngFilled As Long
Dim strBuffer As String
lngLen = MAX_PATH
Do
strBuffer = Space(lngLen)
lngFilled = GetFullPathName( strName, lngLen, strBuffer,
vbNullString)
If lngFilled > lngLen Then
lngLen = lngFilled
End If
Loop Until lngFilled < lngLen
adhFullPath = Left$(strBuffer, lngFilled)
End Function