Gborden800
New Member
- Joined
- May 13, 2009
- Messages
- 25
- Office Version
- 365
- Platform
- Windows
Hi All, I have the following bit of code that I need to modify to run on both 32 and 64 bit versions of Excel.
Is the If-Then-Else statement okay (addition of PtrSafe and LongPtr are correct)?
Do I also need to put the BROWSEINFO declaration inside the If-Then-Else statement with Longptr types for the 64 bit version and Long types for the 32 bit version?
Is the If-Then-Else statement okay (addition of PtrSafe and LongPtr are correct)?
Do I also need to put the BROWSEINFO declaration inside the If-Then-Else statement with Longptr types for the 64 bit version and Long types for the 32 bit version?
VBA Code:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' modBrowseFolder
' This contains the BrowseFolder function, which displays the standard Windows Browse For Folder
' dialog. It returns the complete path of the selected folder or vbNullString if the user cancelled.
' It also contains the function BrowseFolderExplorer which presents the user with a Windows
' Explorer-like interface to pick the folder.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Const BIF_RETURNONLYFSDIRS As Long = &H1
Private Const BIF_DONTGOBELOWDOMAIN As Long = &H2
Private Const BIF_RETURNFSANCESTORS As Long = &H8
Private Const BIF_BROWSEFORCOMPUTER As Long = &H1000
Private Const BIF_BROWSEFORPRINTER As Long = &H2000
Private Const BIF_BROWSEINCLUDEFILES As Long = &H4000
Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszINSTRUCTIONS As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
#If VBA7 Then
Private Declare PtrSafe Function SHGetPathFromIDListA Lib "shell32.dll" (ByVal pidl As LongPtr, _
ByVal pszBuffer As String) As Long
Private Declare PtrSafe Function SHBrowseForFolderA Lib "shell32.dll" (lpBrowseInfo As _
BROWSEINFO) As Long
#Else
Private Declare Function SHGetPathFromIDListA Lib "shell32.dll" (ByVal pidl As Long, _
ByVal pszBuffer As String) As Long
Private Declare Function SHBrowseForFolderA Lib "shell32.dll" (lpBrowseInfo As _
BROWSEINFO) As Long
#End If