Bit worried about this one and I’ve looked around and found lots of posts with similar problems, but not many of them have fixes.
Windows 2008 server and Domino running as a service (as it should). I’ve installed Office 2007 on the server to run an export. The code is executed from a web browser, but throws the following error when it tries to save the excel spreadsheet.
“OLE: Automation object error(213)”
It works fine when I try to run it from a Lotus Notes Client locally.
I’ve changed the Runtime security level to “2. Allow restricted operations without success”, “1. Do not allow restricted operations” does not work at all, it fails much earlier and although I have tried using “3. Allo restricted operations with full administration rights”, I don’t think it’s necessary, so have left it on “2. Allow restricted operations”.
Code is as follows:
Dim session As NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set session = New NotesSession
Set db = session.currentDatabase
Dim myobject As Variant
Dim mysheet As Variant
Set myobject = createObject("Excel.application.12") ' 12 for version 12 (2007) otherwise just Excel.application
myobject.workbooks.add
Set mysheet = myobject.workbooks(1).Worksheets(1)
mysheet.name = "Review"
mysheet.cells(2, 5).value="Transfer to Excel"
mysheet.cells(2, 5).Font.Size=14
mysheet.cells(2, 5).Font.ColorIndex=3
mysheet.cells(2, 5).Font.Bold = True
Dim fmlaval As Variant
mysheet.cells.Columns.autofit
'Debugging shows that it fails on the next line
mysheet.SaveAs "C:\Downloads\test","56" ' "56" means 97 to 2003 version
myobject.visible=True
myobject.quit
Set myobject = Nothing ' free up the memory
Subject: This worked for me
They forgot to create a temp folder…
Cheers,
Beppe
Subject: Security and Domino access to Excel on the server
I thought that it might be a case of the Domino server not having enough access to Excel on the server, it could still be this, but I did try right clicking Excel on the server and on the security tab increasing the rights of “Everyone” and “Users” to “Full Access”. “System” and “Administrators” already have “Full Access”.
This doesn’t seem to have worked. I’m assuming that as the Domino Server is running as a service it comes under “System” for rights? I’ve also right clicked the folder that I’m trying to save the new xls file into and changed all the entries to have “Full Access”, but no joy.
Subject: Excel File Format
It’s certainly creating instances of Excel and doing it as User “System” as I have to kill them off from task manager, so I don’t think write access is the issue, although I’m not ruling anything out.
Found this that is quite interesting about file formats and Excel 2007.
Think I’ve covered this by entering 56 which specifies to save it as an xls rather than an xlsx.
This also has a number of examples where they don’t use slashes "" in the filepath.
http://www.bigresource.com/VB-HELP-Using-VBScript-to-call-EXCEL-039-s-SaveAs-method--UHEZTQfSkP.html
Had no joy with it either though.
Would really appreciate some help guys.
Subject: Drowning here…
I’ve tried this using a W2k3 server, W2k8 server with both Office 2k7 and Office 2k. I get the same error message with each combination.
It’s got to be something in my code.
I’ve looked through all the sandbox results for excel export and they all save excel files in the same way, although there were a couple where I couldn’t work out how they were saving the excel files.
Could anyone post the line that they’ve used to save the excel spreadsheet, I want to try each different option.
Thanks
Ross
Subject: Similar issues
I’ve got an agent that creates an Excel file, saves it to disk, then adds items, saves it again and then attaches it to a Notes document.
It keeps failing in the SaveAs with that 213 error, refusing to use the filename I supply.
Did you figure this out? Reading StackOverflow hasn’t helped.
Subject: Mine was far easier
On mine, I had been using “C:/TEMP/” as the path for the file to be saved to and it kept failing on machines with Notes 8.0.2 and Excel 2010.
On my own machines, which had Notes 8.5.3 and Excel 2007 or 2010, it would save, but then not delete.
Once I switched to using "C:\TEMP", it both save and delete on all machines.
Now, there may have been different reasons other than those particular versions that caused a problem. Who knows?