Cannot see Excel library in available project references
Hi
I am trying to resurrect an old VB6 project on a new server but I am hitting a problem with some of its Excel related functionality and, in particular, the "Save As" (HTML) functionality which is generating an error in the HTML "This page uses frames, but your browser doesn't support them".
As this project is still active and working on an old server, as a first step, I thought I'd install Excel 2003 (as used on that server) on the newer machine I'm testing on. However, my next step is to go into the project and change the reference from "Microsoft Excel 14.0 Object Library" to "Microsoft Excel 11.0 Object Library" but the latter is not showing in the available references. I assumed it would appear followingf the Excel 2003 install. I aslo tried running the Excel EXE with /regserver switch but that had no effect.
I am aware that Excel v14 (Excel 2010) is also pretty old but I know the same logic is failing on another machine with a relatively current version of Excel.
Any help as to how I can resolvge this problem would be greatly appreciated.
Many thanks.
Re: Cannot see Excel library in available project references
Ah, solved it. I had to remove the Excel 14 reference, close the references dialog, re-open it, then browse to the Excel 2003 executable and add it. Apologies for any time wasted.
Re: Cannot see Excel library in available project references
Don't use references to Excel or any other Office products, instead of use objects, with this you will not have problems compiling your projects even if you don't have office installed.
Re: Cannot see Excel library in available project references
Quote:
Originally Posted by
zx81sp
Don't use references to Excel or any other Office products, instead of use objects, with this you will not have problems compiling your projects even if you don't have office installed.
Thanks but I don'y really understand - what are you suggesting as an alternative in the case of Excel 2003?
Re: Cannot see Excel library in available project references
Quote:
Originally Posted by
JustNod
Thanks but I don'y really understand - what are you suggesting as an alternative in the case of Excel 2003?
You can add to your project a reference (for example) to Excel 11.0 and use this code:
Code:
Dim excapp As Excel.Application
Dim exdoc As Excel.Workbook
Set excapp = CreateObject("Excel.Application")
Set exdoc = excapp.Workbooks.Open(App.Path & "\Book1.xls")
Or you can do the same without using any reference in your project:
Code:
Dim exapp As object
Dim exdoc As object
Set exapp = createObject("Excel.Application")
Set exdoc= exapp.Worksheets....
Re: Cannot see Excel library in available project references
Quote:
Originally Posted by
zx81sp
You can add to your project a reference (for example) to Excel 11.0 and use this code:
Ah I see, thank you for spelling it out for me. I will give that a go but, if I have 2 versions of Excel installed how would I distinguish between the two please?
Re: Cannot see Excel library in available project references
Quote:
Originally Posted by
JustNod
Ah I see, thank you for spelling it out for me. I will give that a go but, if I have 2 versions of Excel installed how would I distinguish between the two please?
You won't have intellisense while you are debugging in IDE using that method. But it is easy to go back and forth. Just an fyi