4

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("Action",new Variant("enumVal1"));   \\just pseudo code
Giulio Caccin
  • 2,962
  • 6
  • 36
  • 57
Fredrik L
  • 1,790
  • 4
  • 21
  • 28

2 Answers2

0

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

enter image description here

Mohsen Safari
  • 6,669
  • 5
  • 42
  • 58
Chadi
  • 737
  • 1
  • 6
  • 21
0

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.

Jacob Zwiers
  • 1,092
  • 1
  • 13
  • 33