"The parameter is incorrect" with Office 2010 command bar

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

"The parameter is incorrect" with Office 2010 command bar
 
Michel Brazeau




Posts: 17
Joined: 2006-08-31
Hi,

I'm porting a Word/Power Point/Excel/Outlook addin from 32 to 64 bit. It was initially developed before Office 2010.

For Word, I'm creating a command bar,

FWordCommandBar := TadxCommandBar.Create(Self);
FWordCommandBar.CommandBarName := 'EDC';
FWordCommandBar.SupportedApps := [ohaWord];
FWordCommandBar.Protection := adxMsoBarNoChangeVisible;
FWordCommandBar.Position := adxMsoBarTop;

and then in the

TAddInModule.WordWindowActivate(ASender: TObject; const Doc: Word2000.WordDocument; const Wn: Word2000.Window)

I make the command bar visible with,

Doc.CommandBars.Item[FWordCommandBar.CommandBarName].Set_Visible(True);

Word raises an exception EOleException "The parameter is incorrect".

The same code works well in 32 bit with.

Is this a problem with word 2010 not supported the "command bar"? Or a 64 bit related problem?

I have the "patched" ComObj.Pas for Delphi XE2 update 4.

Any help appreciated.

Best regards,

Michel
Posted 26 Jun, 2012 14:30:10 Top
Michel Brazeau




Posts: 17
Joined: 2006-08-31
Sorry about this. I should have read the manual! I found,

<<
To display a command bar in Office 2007-2010 you must explicitly set the UseForRibbon property of the command bar component to True. The controls added to such a command bar will be shown on the built-in Ribbon tab called Add-ins.
>>

That works perfectly. I assume UseForRibbon := True will have no effect on versions of Office before 2007?

Thanks again,

Michel
Posted 27 Jun, 2012 08:42:38 Top
Andrei Smolin


Add-in Express team


Posts: 18827
Joined: 2006-05-11
Hi Michel,

Michel Brazeau writes:
That works perfectly. I assume UseForRibbon := True will have no effect on versions of Office before 2007?


Of course.


Andrei Smolin
Add-in Express Team Leader
Posted 27 Jun, 2012 10:32:59 Top