VBA Express Forum  




Go Back   VBA Express Forum > Mac Users > Mac VBA Help
     Feedback     
Register FAQ Members Arcade Knowledge Base Training Articles Consulting

Reply
 
Thread Tools Display Modes
Old 04-29-2012, 03:44 AM   #1
Aussiebear
 
Aussiebear's Avatar
Moderator

 
Joined: Dec 2005
Posts: 2,765
Kb Entries: 0
Articles: 0
Solved: Make a new folder error

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.

VBA:
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
VBA tags courtesy of www.thecodenet.com


Remember To Do the Following....

Use the VBA button to correctly submit your code to the forum. Mark your thread as Solved if satisfied by using the Thread Tools options

Local Time: 04:59 PM
Local Date: 05-24-2013
Location:

 
Reply With Quote Top
Old 04-29-2012, 02:04 PM   #2
mikerickson
 
mikerickson's Avatar
Mac Moderator

 
Joined: May 2007
Posts: 2,245
Kb Entries: 0
Articles: 0
Instad of MacScript, have you tried MsgBox to make sure that all the sytanx is correct in the ScriptToMakeDir string?

Local Time: 11:59 PM
Local Date: 05-23-2013

 
Reply With Quote Top
Old 04-29-2012, 03:51 PM   #3
Aussiebear
 
Aussiebear's Avatar
Moderator

 
Joined: Dec 2005
Posts: 2,765
Kb Entries: 0
Articles: 0
Mike, I have fixed an error relating to the spaces between ""mkdir -p"" and this has resolved the syntax error message, but has now been replaced by the error message "expected end of statement" and highlights the word "form" in the same line.


Remember To Do the Following....

Use the VBA button to correctly submit your code to the forum. Mark your thread as Solved if satisfied by using the Thread Tools options

Local Time: 04:59 PM
Local Date: 05-24-2013
Location:

 
Reply With Quote Top
Old 04-30-2012, 01:08 PM   #4
mikerickson
 
mikerickson's Avatar
Mac Moderator

 
Joined: May 2007
Posts: 2,245
Kb Entries: 0
Articles: 0
http://macscripter.net/

has an AppleScipt forum that could help with AS syntax, etc.

Local Time: 11:59 PM
Local Date: 05-23-2013

 
Reply With Quote Top
Old 04-30-2012, 04:28 PM   #5
Aussiebear
 
Aussiebear's Avatar
Moderator

 
Joined: Dec 2005
Posts: 2,765
Kb Entries: 0
Articles: 0
Thank you


Remember To Do the Following....

Use the VBA button to correctly submit your code to the forum. Mark your thread as Solved if satisfied by using the Thread Tools options

Local Time: 04:59 PM
Local Date: 05-24-2013
Location:

 
Reply With Quote Top
Old 05-02-2012, 04:53 AM   #6
Aflatoon
 
Aflatoon's Avatar

 
Joined: Sep 2009
Posts: 734
Kb Entries: 0
Articles: 0
you can't use a line continuation character in the middle of a string:
VBA:
ScriptToMakeDir = ScriptToMakeDir & "do shell script ""mkdir -p "" & quoted _ form of posix path of " & Chr(34) & FolderString & Chr(34) & Chr(13)
VBA tags courtesy of www.thecodenet.com
should be
VBA:
ScriptToMakeDir = ScriptToMakeDir & "do shell script ""mkdir -p "" & quoted" & _ " form of posix path of " & Chr(34) & FolderString & Chr(34) & Chr(13)
VBA tags courtesy of www.thecodenet.com


Be as you wish to seem

Local Time: 09:59 AM
Local Date: 05-24-2013

 
Reply With Quote Top
Old 05-03-2012, 01:31 AM   #7
Aussiebear
 
Aussiebear's Avatar
Moderator

 
Joined: Dec 2005
Posts: 2,765
Kb Entries: 0
Articles: 0
Thank you


Remember To Do the Following....

Use the VBA button to correctly submit your code to the forum. Mark your thread as Solved if satisfied by using the Thread Tools options

Local Time: 04:59 PM
Local Date: 05-24-2013
Location:

 
Reply With Quote Top
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 11:59 PM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © 2004 - 2012 VBA Express