Aussiebear
04-29-2012, 03:44 AM
I am trying to make a new folder to hold VBA Examples on the New Apple I only just purchased.
The supplied code contains a syntax error in the ninth line. It was copied from Ron deBruin's site and appears to be an accurate copy. All that I have altered is the actual path name required for the folder to be created in.
Sub MakeFolderIfNotExist()
Dim FolderString As String
Dim ScriptToMakeDir As String
'Make folder named VBAExamples on the harddrive
FolderString = MacScript("return (path to harddrive folder) as string") & "VBAExamples:"
'Or enter the complete path
'FolderString = "Macintosh HD:Users:Edward Eggleston:VBAExamples:"
ScriptToMakeDir = "tell application " & Chr(34) & "Finder" & Chr(34) & Chr(13)
ScriptToMakeDir = ScriptToMakeDir & "do shell script ""mkdir -p "" & quoted _
form of posix path of " & Chr(34) & FolderString & Chr(34) & Chr(13)
ScriptToMakeDir = ScriptToMakeDir & "end tell"
On Error Resume Next
MacScript (ScriptToMakeDir)
On Error GoTo 0
End Sub
The supplied code contains a syntax error in the ninth line. It was copied from Ron deBruin's site and appears to be an accurate copy. All that I have altered is the actual path name required for the folder to be created in.
Sub MakeFolderIfNotExist()
Dim FolderString As String
Dim ScriptToMakeDir As String
'Make folder named VBAExamples on the harddrive
FolderString = MacScript("return (path to harddrive folder) as string") & "VBAExamples:"
'Or enter the complete path
'FolderString = "Macintosh HD:Users:Edward Eggleston:VBAExamples:"
ScriptToMakeDir = "tell application " & Chr(34) & "Finder" & Chr(34) & Chr(13)
ScriptToMakeDir = ScriptToMakeDir & "do shell script ""mkdir -p "" & quoted _
form of posix path of " & Chr(34) & FolderString & Chr(34) & Chr(13)
ScriptToMakeDir = ScriptToMakeDir & "end tell"
On Error Resume Next
MacScript (ScriptToMakeDir)
On Error GoTo 0
End Sub