Hello! I'm creating some simple macros to help my father-in-law with his small business. I wrote the macros (and they worked) on a PC, then found out that he uses a Mac, so I'm trying to convert them. I'm having trouble with one in particular that is supposed to create a Dropbox folder with the customer name (in cell D2) if it doesn't already exist, or give a message saying "Folder already exists" if it does. It works if the folder doesn't exist, but I get an error saying "Path/File access error" if it already exists.
Sub Createfolder()
Path = "/Users/hisusername/Dropbox/Customers/" & [D2]
Folder = Dir(Path, vbDirectory)
If Folder = bvNullString Then
MkDir "/Users/hisusername/Dropbox/Customers/" & [D2]
Else
MsgBox "Folder already exists."
End If
End Sub
Hi Alex,
To create folders in Mac, it's not as easy as in windows.
You have to check the environment:
#If VBA7 then
MkDir ...
#Else
CreateFolderOnMac
#End if
To create a folder on mac, you have a good resource here:
https://www.macexcel.com/examples/filesandfolders/makefolder/