charles van den akker III
Posts: 10
Joined: 2005-11-22
|
Hello..
i have 2 questions:
1) i have created an outlookaddin that allows users to attach database values to any outlook item... this works fine....
Now i want to use the same addin and extend the functionallity to all MS apps... when i add a new adxCommandBar to the Addin and set the supported apps to all MS products... the button is not visible..
what am i doing incorrectly?
2) (temporary solution to point 1)I have created a new addin... for all MS APPS except Outlook, and done what i attempted previously and it works... what i want to do is differentiate between the app that sends the click and then i would like to check if MyCustom Property exists... if not, add it... else if populated, amend it.
I would appreciate your help in this regard...
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Charles,
1) Check the SupportedApps property of your TAddInModule. After changing this property you should register your add-in anew.
2) I think the point 1 will work for you. You can learn what host application is active at the moment by using the HostType property of your TAddInModule.
|
|
charles van den akker III
Posts: 10
Joined: 2005-11-22
|
hi Dmitry...
Nope... i unregister.... register after i made th changes and nothing... i am not sure why...
No matter... i will use the second option for now...
Please give me an example of:
1) accessing HostType Property;
2) Checking for custom property and also writing to custom property in Word, Excel and PowerPoint
Thanx Dude
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Charles,
1) See the code below.
procedure TAddInModule.adxCommandBar1Controls0Click(Sender: TObject);
begin
if HostType = ohaExcel then begin
// TODO
end;
if HostType = ohaWord then begin
// TODO
end;
if HostType = ohaPowerPoint then begin
// TODO
end;
end;
2) See the code below.
uses Office2000, Excel2000;
procedure TAddInModule.adxCommandBar1Controls0Click(Sender: TObject);
var
i, Count: Integer;
IProps: DocumentProperties;
IProp: DocumentProperty;
Value: OleVariant;
begin
if HostType = ohaExcel then
if ExcelApp.Workbooks.Count > 0 then begin
ExcelApp.ActiveWorkbook.CustomDocumentProperties.QueryInterface(IID_DocumentProperties, IProps);
if Assigned(IProps) then
try
IProps.Get_Count(Count);
for i := 1 to Count do begin
IProps.Get_Item(i, adxLCID, IProp);
if Assigned(IProp) then
try
IProp.Get_Value(adxLCID, Value);
ShowMessage(Value);
finally
IProp := nil;
end;
end;
finally
IProps := nil;
end;
end;
end;
|
|