Custom Command Bar and Word SDI

M

Mike Oliver

I have written a custom command bar for Word 2003 that has a
CommandBarComboBox on it. This represents a value that is unique to
the document. When I have multiple documents up and the user switches
between the documents, I am trying to set this value by doing
something like: oComboBox.ListIndex = 3.

When I do this, ALL of my custom toolbar combo boxes are changed. I'm
writing this in C++ so I can't provide a quick sample, but before I
set the ListIndex, I am setting CustimizationContext to ActiveDocument
and I am working from the CommandBars returned from
Application.ActiveDocument.Application.CommandBars.

How do I access the particular combo box on the custom toolbar for the
active document???

Thanks,

Mike Oliver
 
M

Mike Oliver

Some more info/questions:

It seems that no matter what I do, when I set the value for
CommandComboBox.ListIndex, it changes the selection for my combo box
on my custom tool bar for all documents. This seems like a bug wih
Word 2003? Has anyone seen this? Any workaround?

Here is my C++ code:

m_spApplication->CustomizationContext =
m_spApplication->ActiveDocument;
m_spCommandBars = m_spApplication->ActiveDocument->GetCommandBars();

Office::CommandBarPtr spRecordTypeBar = m_spCommandBars->Item["Record
Type"];
Office::_CommandBarComboBoxPtr spRecordTypeControl =
spRecordTypeBar->GetControls()->Item[1];

spRecordTypeControl->ListIndex = 3; // will change the selection for
ALL documents - Word 2003 bug???
 

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