Hi guys,

I am a newbie to VBA programing and a Windows users. I have created a browse button and assigned a macro to it to browse for folder. I got to work some how using the following code


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 Const MAX_PATH As Long = 260

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

Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Boolean
hNameMappings As Long
lpszProgressTitle As String
End Type

Declare Function SHGetPathFromIDListA Lib "shell32.dll" (ByVal pidl As Long, ByVal pszBuffer As String) As Long

Declare Function SHBrowseForFolderA Lib "shell32.dll" (lpBrowseInfo As BrowseInfo) As Long


Then assigned the macro to browse button as


Sub btbrowse()

Range("B1").Value = BrowseFolder("Select A Folder")
If Range("B1").Value = "" Then
MsgBox "You didn't select a folder"
Else
MsgBox "You selected: " & Range("B1").Value
End If

End Sub

as mentioned at http://www.cpearson.com/excel/BrowseFolder.htm

My problem is when I run the above macro in Excel X i get an error since "shell32.dll" isn't present in a MAC.

Any suggestion is appreciated.

Thanks.