I am trying to copy a file if the file exists. If the file does not exist then I want to execute a mdb application that sends an email. I cannot get the mdb to execute when the file is not available. Below is the code I have. Any hel would be appreciated
IfFileExists>\\Nyhcbapp32v\FTProot\GSHOP\WFM2.txt
then CopyFile>\\Nyhcbapp32v\FTProot\GSHOP\WFM.txt,\\Nyhcbapp32v\FTProot\PSCCSA\WFM.txt
Else Run Program>C:\Program Files\Microsoft Office\Office11\MSAccess.exe "E:\DATABASES\STS Requests\JohnFinney\Dave F\GasCar_CustDataExtract\email.mdb" /x "WTYtxt"
endif
IFE context
Moderators: Dorian (MJT support), JRL
Your syntax is a little off. You don't need the "then" although its probably not hurting anything if it was on a separate line as it appears in the forum posting. After I pasted your code into the Macro Scheduler editor It showed up on the same line and ahead of copyfile> so I question whether you ever actually got copyfile> to function. Also "else" and "Run program" need to be on separate lines.
Code: Select all
IfFileExists>\\Nyhcbapp32v\FTProot\GSHOP\WFM2.txt
CopyFile>\\Nyhcbapp32v\FTProot\GSHOP\WFM.txt,\\Nyhcbapp32v\FTProot\PSCCSA\WFM.txt
Else
Run Program>C:\Program Files\Microsoft Office\Office11\MSAccess.exe "E:\DATABASES\STS Requests\JohnFinney\Dave F\GasCar_CustDataExtract\email.mdb" /x "WTYtxt"
endif