Excel 97 on WinXP Pro, early bound problems in VB 
Author Message
 Excel 97 on WinXP Pro, early bound problems in VB

Greetings,

Has anyone else experienced this problem before?...

Excel 97 on Windows XP Pro (SP1)
Calling from VB6... (SP5)

    Set objApp = New Excel.Application
    objApp.Workbooks.Open "c:\test.xls"
    objApp.Workbooks(1).Close
    objApp.Quit
    Set objApp = Nothing

This produces an error on line 2: "Method Open of workbooks failed" (or
something like that)

Change line 1 to be the late bound call: Set objApp =
CreateObject("Excel.Application") and it works fine.

Anoyingly, the first example works fine on Win2000.

I already tried re-registering the app using Excel /RegServer it didn't fix
it.

Any clues anyone?

Thanks in advance.

Tim H



Fri, 29 Jul 2005 21:03:17 GMT  
 Excel 97 on WinXP Pro, early bound problems in VB
is your reference in VB to the Excel 97 object library?  Late binding is
probably better to avoid these type problems.

Regards,
Tom Ogilvy


Quote:
> Greetings,

> Has anyone else experienced this problem before?...

> Excel 97 on Windows XP Pro (SP1)
> Calling from VB6... (SP5)

>     Set objApp = New Excel.Application
>     objApp.Workbooks.Open "c:\test.xls"
>     objApp.Workbooks(1).Close
>     objApp.Quit
>     Set objApp = Nothing

> This produces an error on line 2: "Method Open of workbooks failed" (or
> something like that)

> Change line 1 to be the late bound call: Set objApp =
> CreateObject("Excel.Application") and it works fine.

> Anoyingly, the first example works fine on Win2000.

> I already tried re-registering the app using Excel /RegServer it didn't
fix
> it.

> Any clues anyone?

> Thanks in advance.

> Tim H



Fri, 29 Jul 2005 22:06:56 GMT  
 Excel 97 on WinXP Pro, early bound problems in VB
Hi Tmo,

It is to referencing Excel 97, but this is installed on both PCs.
I agree. Late binding sovles the problem but it is avoiding the issue.
There shouldn't be a problem.

Cheers,

Tim H


Quote:
> is your reference in VB to the Excel 97 object library?  Late binding is
> probably better to avoid these type problems.

> Regards,
> Tom Ogilvy



> > Greetings,

> > Has anyone else experienced this problem before?...

> > Excel 97 on Windows XP Pro (SP1)
> > Calling from VB6... (SP5)

> >     Set objApp = New Excel.Application
> >     objApp.Workbooks.Open "c:\test.xls"
> >     objApp.Workbooks(1).Close
> >     objApp.Quit
> >     Set objApp = Nothing

> > This produces an error on line 2: "Method Open of workbooks failed" (or
> > something like that)

> > Change line 1 to be the late bound call: Set objApp =
> > CreateObject("Excel.Application") and it works fine.

> > Anoyingly, the first example works fine on Win2000.

> > I already tried re-registering the app using Excel /RegServer it didn't
> fix
> > it.

> > Any clues anyone?

> > Thanks in advance.

> > Tim H



Sat, 30 Jul 2005 19:07:14 GMT  
 Excel 97 on WinXP Pro, early bound problems in VB
Why do you say to MO that you will try his method when you have already
said:

Change line 1 to be the late bound call: Set objApp =
CreateObject("Excel.Application") and it works fine.

His method is the same (late binding) except the syntax is incorrect and it
will raise an error.   Also, adding the 8 to the argument, even properly,
does nothing - if xl97 and xl2000 are both installed, it will not select
excel 97 (or xl2000 if 9 is specified).  the last version installed will be
started or whatever version the registry is pointing to.

Regards,
Tom Ogilvy


Quote:
> Hi Tmo,

> It is to referencing Excel 97, but this is installed on both PCs.
> I agree. Late binding sovles the problem but it is avoiding the issue.
> There shouldn't be a problem.

> Cheers,

> Tim H



> > is your reference in VB to the Excel 97 object library?  Late binding is
> > probably better to avoid these type problems.

> > Regards,
> > Tom Ogilvy



> > > Greetings,

> > > Has anyone else experienced this problem before?...

> > > Excel 97 on Windows XP Pro (SP1)
> > > Calling from VB6... (SP5)

> > >     Set objApp = New Excel.Application
> > >     objApp.Workbooks.Open "c:\test.xls"
> > >     objApp.Workbooks(1).Close
> > >     objApp.Quit
> > >     Set objApp = Nothing

> > > This produces an error on line 2: "Method Open of workbooks failed"
(or
> > > something like that)

> > > Change line 1 to be the late bound call: Set objApp =
> > > CreateObject("Excel.Application") and it works fine.

> > > Anoyingly, the first example works fine on Win2000.

> > > I already tried re-registering the app using Excel /RegServer it
didn't
> > fix
> > > it.

> > > Any clues anyone?

> > > Thanks in advance.

> > > Tim H



Sat, 30 Jul 2005 22:15:13 GMT  
 Excel 97 on WinXP Pro, early bound problems in VB
What I didn't tell you is that the objApp is defined as Object is the late
bound example instead of Excel.Application from the early bound type lib.

Maybe "Excel.8" is compatable with the typed variable.

As for why I said I'd try it. Hey, I'll try anything once!
Enough talking, I'll try it when I get home and let you know.
Maybe tomorrow you can tell me "told you so"

Cheers,

Tim H


Quote:
> Why do you say to MO that you will try his method when you have already
> said:

> Change line 1 to be the late bound call: Set objApp =
> CreateObject("Excel.Application") and it works fine.

> His method is the same (late binding) except the syntax is incorrect and
it
> will raise an error.   Also, adding the 8 to the argument, even properly,
> does nothing - if xl97 and xl2000 are both installed, it will not select
> excel 97 (or xl2000 if 9 is specified).  the last version installed will
be
> started or whatever version the registry is pointing to.

> Regards,
> Tom Ogilvy



> > Hi Tmo,

> > It is to referencing Excel 97, but this is installed on both PCs.
> > I agree. Late binding sovles the problem but it is avoiding the issue.
> > There shouldn't be a problem.

> > Cheers,

> > Tim H



> > > is your reference in VB to the Excel 97 object library?  Late binding
is
> > > probably better to avoid these type problems.

> > > Regards,
> > > Tom Ogilvy



> > > > Greetings,

> > > > Has anyone else experienced this problem before?...

> > > > Excel 97 on Windows XP Pro (SP1)
> > > > Calling from VB6... (SP5)

> > > >     Set objApp = New Excel.Application
> > > >     objApp.Workbooks.Open "c:\test.xls"
> > > >     objApp.Workbooks(1).Close
> > > >     objApp.Quit
> > > >     Set objApp = Nothing

> > > > This produces an error on line 2: "Method Open of workbooks failed"
> (or
> > > > something like that)

> > > > Change line 1 to be the late bound call: Set objApp =
> > > > CreateObject("Excel.Application") and it works fine.

> > > > Anoyingly, the first example works fine on Win2000.

> > > > I already tried re-registering the app using Excel /RegServer it
> didn't
> > > fix
> > > > it.

> > > > Any clues anyone?

> > > > Thanks in advance.

> > > > Tim H



Mon, 01 Aug 2005 00:32:43 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Early binding: Office 97 & 2000 objects

2. Early binding and Late binding in VB.

3. Early bind and Late bind in VB.

4. Early binding and Late binding in VB.

5. dao no current record error [was early binding to excel]

6. early binding to excel

7. Excel early binding, Error 13 - Type mismatch?

8. Excel early binding, Error 13 - Type mismatch?

9. early vs. late binding to excel in VB6

10. Excel early binding, Error 13 - Type mismatch?

11. HELP HELP HELP Early Binding Excel 5.0 HELP HELP HELP

12. Help, VB6 Pro WinXP Pro Win98 2nd

 

 
Powered by phpBB® Forum Software