FAQ
Hi all,

I have the following problem using the office 9.0 object library. When I
generate the Office 9.0 Object library using makepy the following code
does not work, but when I use the dynamic dispatch method it does. How
do I solve the problem using the early bound dispatch method as I need
early binding for other features (constants etc)?

This method is defined in my server class and the self.application
attribute points to a valid Excel.Application instance

1:def AddCustomMenu(self):
2:
cbMenuBar = self.application.CommandBars("Worksheet Menu Bar")
3:
muCustom = cbMenuBar.Controls.Add(Type = 10) # msoControlPopup
4:
5:
muCustom.Caption = "Toolkit"
6:
7:
item = muCustom.Controls.Add(Type = 1) # msoControlButton
8:
item.Caption = "Show Data Form"


The problem is on line 7. muCustom is of type CommandBarControl in the
early binding case. In the late(dynamic) binding case it is a
CommandBarPopup. CommandBarControl does not have a Controls property
where CommandBarPopup does.

How can i rectify the problem? (typecast ?) How?

Regards
Gerrit van Dyk

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedMar 26, '02 at 9:37a
activeMar 26, '02 at 9:37a
posts1
users1
websitepython.org

1 user in discussion

Gerrit van Dyk: 1 post

People

Translate

site design / logo © 2022 Grokbase