Scheduled task error out

  • Thread starter Sam8932 via AccessMonster.com
  • Start date
S

Sam8932 via AccessMonster.com

I have a scheduled task set up to run a .bat file that starts a macro in an
Access DB. The DB pulls down files from an SFTP server and then loads them
to a table. I then export them to an excel file and save that file to a .csv
file to be loaded to another SFTP server. When I run the .bat file it works
fine. When I try running it from the scheduled task (set up under the same
user name I'm running the .bat file with) it errors out when it tries saving
the .xls file to a .csv file. I get a "Permission denied" error.

..bat file:
"C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe" "C:\SendCDBRecsToDW\
Compile_Files.mdb" /x Compile_Data

Code that is erroring out:
Set wb = xlApp.Workbooks.Open(strFilePath & strFileNameExtract)
---> wb.SaveAs strFilePath & strFileNameUpload, FileFormat:=xlCSV
wb.Close False

It creates the .xls file but errors out when saving it to a .csv file. It
seems like Access can't properly launch the Excel object when Access is being
launched from the scheduled task.

I'm stumped and would appreciate any help I can get on this. I need to get
this figured out ASAP!

Thank you in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top