开发者

Passing Enumeration value using Jacob bridge (COM/ActiveX)

Does anyone know if there's a way to pass an enumeration value using Jacob?

ComObj.ComEnum.enumVal1
ComObj.ComEnum.enumVal2

I'd like to pass enumVal1 or enumVal2 as a Variant.

o.invoke("Actio开发者_Python百科n",new Variant("enumVal1"));   \\just pseudo code


The enum values are available in the Object Browser of the Macro Editor.

Passing Enumeration value using Jacob bridge (COM/ActiveX)


The OP seems to be asking about how to make the actual call... of which obtaining the underlying values (as shown by @ChadiEM) is be one part.

I found a post on the subject which says the values ... correspond to internally stored numbers and An enumeration in VBA is always of data type Long.

So, with this info and values , it's simply a matter of passing a Variant with the value as a long. For example:

o.invoke("Action",new Variant(34L));

I'm sure there's a way to get actual "Enumeration" data structures, but this was good enough for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜