installation of add-in according to office versions

C

Carlos

Hi,

I'm trying to install add-in according to the office version
that the user has. My installation is based on the
vb setup toolkit, and it is using a CAB file, but I am not
sure how to distinguish between office versions before
the add-in is deployed. Can you tell me of a way on how to accomplish
this?

Thanks,

Carlos.
 
Z

Zweitze de Vries

Carlos said:
I'm trying to install add-in according to the office version
that the user has. My installation is based on the
vb setup toolkit, and it is using a CAB file, but I am not
sure how to distinguish between office versions before
the add-in is deployed. Can you tell me of a way on how to accomplish
this?


I'm not sure about the vb setup toolkit, but most setup creation programs
(InstallShield, Wise, etc.) are extendable, and allow you to include your
own logic. You could use that to detect the installed office version.

I recommend against this approach: some users have multiple office versions
installed, and sometimes a user upgrades office after installing your
software.
Consider rewriting your add-ins to one add-in for all versions. This add-in
detects the office version, and behaves accordingly.
 
C

Carlos

Thanks for your response Zweitze,

I am asking about that approach because I have an
add-in that I wrote using the office 9 (2000) object model, but there is
one feature that I need that is available in the office 10 (XP) object
model.
However, I think that if I compile my add-in under office XP, it will not
be
backward compatible in office 2000. (Am I right?), or is there any way to
make
the add-ins backward compatible..?

Thanks again,

Carlos.
 
Z

Zweitze de Vries

Do you know the difference between early-bound and late-bound programming?
If you do: compile everything against the Office 2000 object model, and
include an Office version check. If the version is 10 or higher, call the
new function late-bound.

How to do that, depends on your compiler. I code in Delphi, and I try to set
a transparent Commandbarbutton image. In Office 2000, you can only do so
using the clipboard, destroying the current contents on the way. In Office
2000 new Commandbarbutton methods were introduced, allowing you to keep the
clipboard as is.

So in Delphi:

var
MyButton: ICommandbarButton;
MyButtonLatebound: Variant;
begin
[...]
// Test OfficeXP or higher
if OfficeMajorVersion > 9 then
MyButtonLatebound := MyButton; // Delphi sorts this out
MyButtonLatebound.Set_Picture(Pict);
MyButtonLatebound.Set_Mask(Pict);
end
else begin
// Office 2000: use the clipboard
end;

About above code: OfficeMajorVersion is derived from the Version property
(which is a complete string) of the Office application object.
 
C

Carlos

Zweitze,

thanks again for your very valuable help. I indeed intended
to do just that but for some reason my VB6 code does not
show my late bound filedialog when I instantiated after
detecting the versioning. Here is the code, and I would appreciate
if you, or somebody else in this newsgroup can tell me what is wrong..
Thanks in advance..

when trying to late bind... my dilaogbox does not show when I have..

If iVer > 9 Then
Dim oSaveAsDialog As Object
Set oSaveAsDialog =
CreateObject("oApp.FileDialog(msoFileDialogSaveAs)")
oSaveAsDialog.Show
NewDocName = oSaveAsDialog.SelectedItems(1)
...
...

when I compile under office XP and above, life is good when I have...

Dim oSaveAsDialog As Office.FileDialog
Set oSaveAsDialog = oApp.FileDialog(msoFileDialogSaveAs)
oSaveAsDialog.Show
NewDocName = oSaveAsDialog.SelectedItems(1)

can anybody share some light?

Thanks,

Carlos.

Zweitze de Vries said:
Do you know the difference between early-bound and late-bound programming?
If you do: compile everything against the Office 2000 object model, and
include an Office version check. If the version is 10 or higher, call the
new function late-bound.

How to do that, depends on your compiler. I code in Delphi, and I try to set
a transparent Commandbarbutton image. In Office 2000, you can only do so
using the clipboard, destroying the current contents on the way. In Office
2000 new Commandbarbutton methods were introduced, allowing you to keep the
clipboard as is.

So in Delphi:

var
MyButton: ICommandbarButton;
MyButtonLatebound: Variant;
begin
[...]
// Test OfficeXP or higher
if OfficeMajorVersion > 9 then
MyButtonLatebound := MyButton; // Delphi sorts this out
MyButtonLatebound.Set_Picture(Pict);
MyButtonLatebound.Set_Mask(Pict);
end
else begin
// Office 2000: use the clipboard
end;

About above code: OfficeMajorVersion is derived from the Version property
(which is a complete string) of the Office application object.
--
Zweitze de Vries
Cyco Software
Rijswijk, The Netherlands

Carlos said:
Thanks for your response Zweitze,

I am asking about that approach because I have an
add-in that I wrote using the office 9 (2000) object model, but there is
one feature that I need that is available in the office 10 (XP) object
model.
However, I think that if I compile my add-in under office XP, it will not
be
backward compatible in office 2000. (Am I right?), or is there any way to
make
the add-ins backward compatible..?

Thanks again,

Carlos.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top