troubleshooting Question

VBA MkDir not working on Office:mac 2016 / Office365

Avatar of Jamie Garroch (MVP)
Jamie Garroch (MVP)Flag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft OfficeMicrosoft 365Office ProductivityMac OS XVBA
10 Comments1 Solution1426 ViewsLast Modified:
I'm sure this used to work but on the latest version of Office:mac 2016 (16.19 / 181001) the MkDir function appears to be broken.

Both of these lines will create a folder called "test", the second in the Office sandbox: (substitute "[USERNAME]" accordingly)

MkDir "/Users/[USERNAME]/Documents/test"
MkDir "/Users/[USERNAME]/Library/Group Containers/UBF8T346G9.Office/test"
But neither of them are accessible programmatically or via Finder:

Mac folder access error
As a workaround, I tried using this script with the VBA MacScript function below but it returns error 5 when used in VBA even though it works in the OSX ScriptEditor app:

tell application "Finder"
	set p to path to documents folder
	make new folder at p with properties {name:"ZIP"}
end tell

Public Sub MakeMacFolder()
  Dim tAppleScript As String
  tAppleScript = tAppleScript & "tell application ""Finder""" & vbCr
  tAppleScript = tAppleScript & "set p to path to documents folder" & vbCr
  tAppleScript = tAppleScript & "make new folder at p with properties {name:""test""}" & vbCr
  tAppleScript = tAppleScript & "end tell"
  MacScript tAppleScript
End Sub

What is wrong and is there a workaround for this?
Jamie Garroch (MVP)
PowerPoint Technical Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros