From: GS on
Helmut Meukel formulated the question :
> Hmm,
>
> in your VB6 program you have reverenced something like
> EXCEL10.OLB, the excel object library. You may run into
> problems when the excel version installed on the target system
> is older. A few days ago I upgraded an app on a custumers
> system with only Office 97. So I searched on my multi-boot
> dev system for EXCEL8.OLB, found it on one of the other
> system partitions and refereced it. The compiled exe had no
> problem on my system with Office 2000. As I later tried a
> small test app, I found in References only EXCEL9.OLB
> and had to browse for EXCEL8.OLB, so it will probably
> work with higher versions.
> I found somewhere a tip to use early binding during
> development to have the benefit of intellisense but then
> switch to late binding to be on the safe side and use trial
> and error to create the excel object. Starting with the
> highest version and then down to the oldest version that
> still supports the essential things you used and skip over
> non-essential features if there is only an old Excel version
> available.
> You could do this using conditional compilation so you can
> switch back to early binding for further development.
>
> Helmut.
>
> "freedom" <user(a)msgroups.net/> schrieb im Newsbeitrag
> news:%23wcaxv9wKHA.3304(a)TK2MSFTNGP06.phx.gbl...
>>I wrote a code in VB6�s
>> ~~
>> Set xlapp = CreateObject("excel.application")
>> xlapp.Visible = True
>> Set xlbook = xlapp.workbooks.open("C:\a.xls")
>> Set xlsheet = xlbook.worksheets(1)
>> xlsheet.Activate
>> ~~
>> It can run in my computer.
>> When I used the VB program and excel file in other computer, it show a
>> message�s
>> ~~
>> Run time error 40036
>> Application-defined or Object-defined error
>> ~~
>>
>> I don't know what can I do.
>> I need use the VB program and the excel file in any other computers.(the
>> excel file have some VBA program).
>>
>> I had made the VB program to .exe file. I think maybe the problem is other
>> computer doesn't install VB6 ?? I made the excel file in excel 2003,but it
>> can't run in excel 2007 ??
>>
>> thanks a lot
>>
>>
>>
>> ---
>> frmsrcurl: http://msgroups.net/microsoft.public.vb.general.discussion

Thanks so much for this good advice! Note that because it is considered
"good practice" within the Excel development community to ALWAYS
compile/save in the earliest version you expect your app to be used
with, I have always done so. This also holds true for early references
to the Excel Object Library, but AFAIK the refs are changed
automatically for whatever version is actually installed on the machine
(..-applies to VBA projects).

I didn't realize this was an issue with VB projects and MS Office
automation. I have VB6 COMAddin DLLs that contain early bound refs for
using the ICustomUI interface for setting custom Ribbon configs. The
refs are to the Excel 12.0 Object Library AND the Office 12.0 Object
Library. This works as expected in versions 9, 10, and 11 and obtains
the correct object ref to whatever version is running. Mind you, all 4
versions are installed on the same machine and so I expect this may be
why it works without issue.

What you're saying here suggests I should test this on a machine that
doesn't have version 12 installed. I can do that easily enough back to
version 9 because I don't develop for anything before Office 2000. (I
have Office 97 Pro but stopped developing for it when XP came along
because it requires too much version specific coding for my liking.
It's bad enough having to do that for v9 thru v11, and v12 adds a whole
new dynamic to that again depending on what you're app is doing.)
--
Garry


From: GS on
Helmut Meukel wrote on 3/17/2010 :
> Hmm,
>
> in your VB6 program you have reverenced something like
> EXCEL10.OLB, the excel object library. You may run into
> problems when the excel version installed on the target system
> is older. A few days ago I upgraded an app on a custumers
> system with only Office 97. So I searched on my multi-boot
> dev system for EXCEL8.OLB, found it on one of the other
> system partitions and refereced it. The compiled exe had no
> problem on my system with Office 2000. As I later tried a
> small test app, I found in References only EXCEL9.OLB
> and had to browse for EXCEL8.OLB, so it will probably
> work with higher versions.
> I found somewhere a tip to use early binding during
> development to have the benefit of intellisense but then
> switch to late binding to be on the safe side and use trial
> and error to create the excel object. Starting with the
> highest version and then down to the oldest version that
> still supports the essential things you used and skip over
> non-essential features if there is only an old Excel version
> available.
> You could do this using conditional compilation so you can
> switch back to early binding for further development.
>
> Helmut.
>
> "freedom" <user(a)msgroups.net/> schrieb im Newsbeitrag
> news:%23wcaxv9wKHA.3304(a)TK2MSFTNGP06.phx.gbl...
>>I wrote a code in VB6�s
>> ~~
>> Set xlapp = CreateObject("excel.application")
>> xlapp.Visible = True
>> Set xlbook = xlapp.workbooks.open("C:\a.xls")
>> Set xlsheet = xlbook.worksheets(1)
>> xlsheet.Activate
>> ~~
>> It can run in my computer.
>> When I used the VB program and excel file in other computer, it show a
>> message�s
>> ~~
>> Run time error 40036
>> Application-defined or Object-defined error
>> ~~
>>
>> I don't know what can I do.
>> I need use the VB program and the excel file in any other computers.(the
>> excel file have some VBA program).
>>
>> I had made the VB program to .exe file. I think maybe the problem is other
>> computer doesn't install VB6 ?? I made the excel file in excel 2003,but it
>> can't run in excel 2007 ??
>>
>> thanks a lot
>>
>>
>>
>> ---
>> frmsrcurl: http://msgroups.net/microsoft.public.vb.general.discussion

The only system I have that doesn't have Office 12 installed is a
"clean" XP SP1 machine with only Office 10 installed. The COMAddin DLL
with the refs to the Office 12.0 Lib AND Excel 12.0 Lib works fine. I
could install vers 8/9 just to check this out further but that will
require removing and reinstalling v10 in order to set things up so they
can coexist on the same machine without issue. I really don't want to
do that because my v10 disc got damaged somehow and now I can't use it.

I'm wondering if the issue you encountered is specific to Office 97!
--
Garry