Page 1 of 1
Syntax question [solved]
Posted: Wed May 07, 2014 1:10 pm
by magice
This doesn't work.
Code: Select all
if there is not a folder "W:/Archives/"&tYear&"/"&tMonth then create folder "W:/Archives/"&tYear&"/"&tMonth
I believe it is an issue with quotation marks, but since the folder name tMonth and tYear are variables, I am having trouble finding the right combination to make it work.
Re: Syntax question
Posted: Wed May 07, 2014 1:38 pm
by Dixie
Try this, putting a space between the ampersands and your variable names...
Code: Select all
if there is not a folder "W:/Archives/" & tYear & "/" & tMonth then create folder "W:/Archives/" & tYear & "/" & tMonth
or maybe..
Code: Select all
put "W:/Archives/"& tYear & "/" & tMonth into thePath
if there is not a folder thePath then create folder thePath
Re: Syntax question
Posted: Wed May 07, 2014 1:40 pm
by Klaus
Hi Magice,
ALWAYS use quotes around concatenated file- and object-names!
Code: Select all
...
if there is not a folder ("W:/Archives/"&tYear&"/"&tMonth) then
create folder ("W:/Archives/"&tYear&"/"&tMonth)
end if
...
Or use this way:
Code: Select all
...
put "W:/Archives/"&tYear&"/"&tMonth into tFolder
if there is not a folder tFolder then
create folder tFolder
end if
...
Best
Klaus
Re: Syntax question
Posted: Wed May 07, 2014 1:52 pm
by magice
Thank you both. the parenthesis are exactly what I needed.