I believe the following will work:
Dim b As CommandButton
Set b = ocx.GetButton("btnPrint")
b = True
As the default property of the CommandButton control in VB6 is a "click" property.
/EDIT by Konrad: The code is correct but the explanation is slightly off. CommandButton
s actually have two functions. One is the usual click button and the other is a toggle button that acts similar to a CheckBox
. The default property of the CommandButton
is actually the Value
property that indicates whether a button is toggled. By setting the property, the Click
event is generated. This is done even if the button is not styled as a ToggleButton
and therefore doesn't change its state.
/EDIT, again by Konrad: I'm sorry for editing your post. What I actually wanted to do was quote your posting, not edit it. Anyway, I'll let the comment stand as it is.
/EDIT, DAC: No problem!