Forum

Macro to create Dro...
 
Notifications
Clear all

Macro to create Dropbox folder on Mac

2 Posts
2 Users
0 Reactions
116 Views
(@agreene52)
Posts: 1
New Member
Topic starter
 

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

 
Posted : 09/07/2021 10:44 am
(@catalinb)
Posts: 1937
Member Admin
 

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/

 
Posted : 10/07/2021 3:16 pm
Share: