Cannot get script to open Excel file
Joined: 17 Aug 2009
Posted: 17 Aug 2009 at 5:52pm
I need to do a SaveAs on an attachment with Excel so it is in the newest version of Excel. Here is my script:
' commands start here
strFile = "c:\reports\wrongformat\content_wrong.xls"
Set objExcel = CreateObject("Excel.Application")
strFile1 = "c:\reports\content.xls"
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
objExcel.Application.DisplayAlerts = False
objExcel.ActiveWorkbook.SaveAs strFile1, -4143
If I run the script manually, it works perfectly. If Email2DB runs the script, it gives this error:
Script error: (&H800a03ec) Microsoft Office Excel cannot access the file 'c:\reports\wrongformat\content_wrong.xls'. There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook. Line 11
As you can see, I am working with local directories only, no network locations. I opened the permissions wide up for Everyone. I can't figure out why the script won't work when Email2DB runs it.
Edited by Typoman - 17 Aug 2009 at 6:58pm
Joined: 29 Jun 2011
The problem here is that the Microsoft Office Scripts can not be called or created via a Service, this is what Email2DB runs as.
When running through the script editor you are running as your user, this is why it goes through fine.
When Email2DB processes an email it is as a service and as such the script cannot be executed and you are presented with the Script Error.
|Forum Jump||Forum Permissions
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum