CommandBarComboBox/macro problem

K

Kent Tessman

I am trying to get something working on Mac Word/VBA that works properly (I
think) on Windows.

I've distilled it down into:
http://www.generalcoffee.com/temp/macrotest.dot

The gist is this:

Upon opening, the document will either use the existing "My Formatting
Toolbar" (InitMyFormattingToolbar) or create a new one if none exists
(CreateMyFormattingToolbar). The important thing is to set style_combo to
the sole CommandBarComboBox on the toolbar. Changes to the toolbar and
combobox should be saved in the document, not the template.

From the document, Ctrl+T (bound to the macro TestDialog) should bring up
the simple dialog UserForm1. Clicking on the only button should run the
button's action routine which (a) adds an item to the style_combo combobox
on the custom toolbar, and (b) prints the combobox's .ListCount property to
the immediate debug window.

Now, the problem is that, for me, at least, (a) works fine, and the item
gets added to the combobox, but (b) fails with the message:

"Method 'ListCount' of object 'CommandBarComboBox' failed"

Note that this only happens (again, for me) on the Mac; it works fine in
Windows.

Any suggestions?
 
K

Kent Tessman

Kent Tessman said:
I am trying to get something working on Mac Word/VBA that works properly (I
think) on Windows.

I've distilled it down into:
http://www.generalcoffee.com/temp/macrotest.dot

The gist is this:

Upon opening, the document will either use the existing "My Formatting
Toolbar" (InitMyFormattingToolbar) or create a new one if none exists
(CreateMyFormattingToolbar). The important thing is to set style_combo to
the sole CommandBarComboBox on the toolbar. Changes to the toolbar and
combobox should be saved in the document, not the template.

From the document, Ctrl+T (bound to the macro TestDialog) should bring up
the simple dialog UserForm1. Clicking on the only button should run the
button's action routine which (a) adds an item to the style_combo combobox
on the custom toolbar, and (b) prints the combobox's .ListCount property
to the immediate debug window.

Now, the problem is that, for me, at least, (a) works fine, and the item
gets added to the combobox, but (b) fails with the message:

"Method 'ListCount' of object 'CommandBarComboBox' failed"

Note that this only happens (again, for me) on the Mac; it works fine in
Windows.

Any suggestions?

Just to follow up on this, I'm able to get it to work sometimes by running
it directly from the VBE. But only sometimes. And it never works for me
with a document created from the template. Is there some sort of
scope/permission/protection I should be aware of that applies only to
VBA/Mac?

If anyone has had a chance to test this, I would be curious to hear if you
see the same behavior.
 

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