|
-
Nov 6th, 2009, 05:55 PM
#1
Thread Starter
New Member
[Resolved] VB6 is creating corrupted Excel 2007 instances
I create reports in Excel from my VB6 exe's. I've done it for years with no problems until Office 2007 came along. The following code fails when it tries to save the workbook (I simplified the code). If I stop the code prior to the 'SaveAs' line and try to save the workbook manually, it still fails. The error in both cases is "-2147417851 Automation Error. The server threw an exception". Its almost as if VB creates a corrupted Excel instance. I can manually do anything to the created instance, but when I try to save it, it fails.
I thought it might be because I am living in the Stone Age (VB6), so I tried it with the free VB 2008. It still fails.
The code only fails on a client PC. It works fine on my development PC (where VB6 is installed). There is something the VB6 install does that prevents the error.
I've tried late and early binding.
Here's the code that fails.
-----------------------------------------------
Dim lx_ExcelApp As Object
lx_ExcelApp = CreateObject("Excel.Application")
lx_ExcelApp.Application.Visible = True
lx_ExcelApp.Application.DisplayAlerts = False
lx_ExcelApp.Workbooks.Add()
lx_ExcelApp.ActiveWorkbook.SaveAs(FileName:="x.xls")
-----------------------------------------------
This is a real show stopper for me. I have searched the Web for weeks looking for a solution (other than installing VB6 on everyclient). PLEASE HELP!!!
Last edited by BillEarl; Nov 8th, 2009 at 05:00 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|