Using OfficeXP features

Add-in Express™ Support Service
That's what is more important than anything else

Using OfficeXP features
 
Nicholas Glasier


Guest


If I include OfficeXP.pas in my uses clause so that I can access the FileDialogFilters object, what will happen if the add-in is used with Office 2000?

Do I need to block the code involved from being run in such a situation, and if so what would be the best way to do it?

Ideally I would like the add-in to work for any version of Office from 2000 on, even if this one feature can only be accessed by users with Office XP or later.

TIA, Nick
Posted 14 Mar, 2007 21:15:19 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nick,

If I include OfficeXP.pas in my uses clause so that I can access the FileDialogFilters object, what will happen if the add-in is used with Office 2000?


I think you will get an exception when accessing non existing property/method.

Do I need to block the code involved from being run in such a situation, and if so what would be the best way to do it?


I think you can check out the OutlookApp.Version property.

P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.

Posted 15 Mar, 2007 09:45:34 Top
Nicholas Glasier


Guest


Thanks Dmitry. That works with everything but Access, which doesn't have a version property.

The question now is how do I access the fileDialogs property of an Office application. I tried using the HostApp property, but it doesn't support the fileDialogs collection. The help inside Word's Visual Basic editor talks about the application object, but how can I access that?

TIA, Nick
Posted 19 Mar, 2007 19:50:13 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nick,

Please see the following code:


uses ExcelXP, OfficeXP;

procedure TAddInModule.adxCommandBar1Controls0Click(Sender: TObject);
var
  Ver: Integer;
begin
  Ver := 9;
  if Pos('.', ExcelApp.Version[adxLCID])
>
 0 then
    Ver := StrToInt(Copy(ExcelApp.Version[adxLCID], 1, Pos('.', ExcelApp.Version[adxLCID]) - 1));
  if Ver
>= 10
 then begin

    [B](ExcelApp.DefaultInterface as ExcelXP._Application).FileDialog[msoFileDialogOpen].Show();[/B]

  end;
end;




Posted 20 Mar, 2007 02:38:42 Top
Nicholas Glasier


Guest


Many thanks Dmitry,

Tweaking that last line gave me the FileDialog filters for everything but Project,Visio, MapPoint, and FrontPage. There aren't any OCX server files for the XP version of those apps.

Many thanks, Nick
Posted 20 Mar, 2007 04:25:16 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nick,

As far as I remember the FileDialog property exists in Excel, Word, PowerPoint and Access host applications only. Of course, starting from version 2002/XP.

Posted 20 Mar, 2007 07:21:30 Top
Nicholas Glasier


Guest


Thanks Dmitry, Publisher 2003 has it too, but you have to QueryInterface the FileDialog to get to the FileFilters. The other apps you mentioned give direct access to the FileFilters property.

Regards, Nick
Posted 20 Mar, 2007 16:21:16 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Nick,

Thank you for the information.

Posted 21 Mar, 2007 06:39:47 Top