ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel fails to open workbook using Automation from VB 6 (https://www.excelbanter.com/excel-programming/339460-excel-fails-open-workbook-using-automation-vbulletin-6-a.html)

lowell

Excel fails to open workbook using Automation from VB 6
 
I am getting an error some machines where I have a VB 6 application
installed. The error is:

Err Number=-2147417851 Method '~' of object '~' failed
Err line number=[897]

Dim xlWB As Excel.Workbook
Dim xlWS As Excel.Worksheet

line 897 is:
897: Set xlWB = xlapp.Workbooks.Open(sFileCopyDest)

The user is running:
Windows version is Microsoft Windows XP 5.1 Build 2600
Microsoft Excel 2003 11.0.6355.0 Microsoft Word 2003 11.0.6502.0

The file being opened is there, no problems. It is an Excel 2003 file on the
users machine.

I looked this up in WINERROR.H and the error referenced is "server threw an
exception." I searched around and found this link:
http://support.microsoft.com/default...b;en-us;891013

which says, in part:
"When you programmatically add a new worksheet to an Excel object that is
contained in an Excel window that is not currently the active window, the
worksheet is not added, and you receive the following error message:
The server threw an exception. (0x80010105)"

I am not doing an Add, although add would be similar in behavior?

This works OK on my development machine in the Visual Studio 6 environment
with Office 2003 installed. The code is compiled to P-code to try and solve
the problem. That did not help. I have tested on several machines amd the
error does not always occur. It does not seem to occur on machines running
prior versions of Excel, which suggests that the hotfix will work. How would
I get the hotfix to users?

Thanks for your help


All times are GMT +1. The time now is 01:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com