Excel automation on Windows Server 2008 x64: solution to SaveAs method problem
April 26th, 2011A customer of mine uses Lotusscript and the Microsoft Excel object to create Excel spreadsheets with scheduled agents. The code is based on the normal way of creating spreadsheets - e.g.:
Set ExcelApp = CreateObject("Excel.Application") Set ExcelWorkbook = ExcelApp.Workbooks.Open("C:test.xls") Set ExcelWorksheet = ExcelWorkbook.Application.Workbooks(1).Worksheets(1)
The scheduled agents worked fine on a Windows Server 2003. The application was then installed on a freshly installed Domino server running on a freshly installed Windows Server 2008 x64 (64 bit) and then the scheduled agents started failing with the following error message: "SaveAs method of Workbook class failed".
After several tries of fixing the code I finally found the simple (but unexpected) solution to the problem: create a folder called "Desktop" in C:\Windows\SysWOW64\config\systemprofile\.
Yes, that's it! just create the folder and then the code starts working again 🙂
Tags: Lotusscript, Microsoft Excel, Windows Server
June 20th, 2011 at 20:51
I had this same problem but with Domino 64Bit on Windows Server 2008 R2 64 bit with Excel.
By adding the "Desktop" directory to c:\windows\system32\config\systemprofile, I got the 64
Bit version of Excell working with Domino 64Bit. I also got Domino 64 bit working with
the 32 Bit version of Excell with the additon of the "Desktop" directory to the
c:\windows\SysWOW64\config\systemprofile directory!!
August 3rd, 2011 at 14:31
The solution mentioned by you has really helped me in solving the same problem. Though I still have a problem that once created the excel does not close or killed and thus execution of my agent also is not completed.
Following is the code written (this works fine on 2003 server):
Call gvMSExcelWorkbk.Close(True) '*** Close the excel workboook
gvMSExcelApp.Quit '*** Close the excel application
Set gvMSExcelWorkbk = Nothing '*** set variable gvMSExcelWorkbk to blank
Set gvMSExcelApp = Nothing '*** set variable gvMSExcelApp to blank
Please let me know if anything else is needed
September 15th, 2011 at 16:03
Hi,
Thanks for the answer it was helpful , tried creating folder as suggested in windows 2008 Server x64 and it worked.
Could you please throw light on following queries
1) is there any patch sets or service packs that can fix this issue in windows server 2008 x64
2) What was the cause for this issue ? is this due to Ms Office or Win Operating system.
July 31st, 2012 at 05:37
I found your solution and it worked for me.
Many thanks Lausten!
August 7th, 2012 at 10:17
Hi,
Open does not work with the procedure specified.
How ever on changing the identtiy in COM... it works.
But changing identiy is not recommened...
Any other solution...
January 2nd, 2013 at 17:37
thnks, it works fine....
January 2nd, 2013 at 17:53
it works find!!
January 17th, 2013 at 09:14
It Works Fine, Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
January 28th, 2013 at 21:16
This is not working for me 🙁 Can someone please help? I did notice that the systemprofile folders have a lock on them. Could that be the problem? I was able to created the Desktop folder but the script still won't run excel.
January 28th, 2013 at 21:57
You probably need admin rights to create that folder.