"Translating" Office object models from the native VBA to use in other language environments can be tricky. Reading code snippets in the other language is a good way to get started - to get a "feel" for how it looks.
One important aspect to notice is that in some languages it's necessary to fully qualify the "namespace" from which something comes. For an Enumeration such as wdColorBlue, for example, the "parent" Enumeration may be necessary, which would be something like WdColor. (Note that the "parent" Enumeration in Word will always start with Wd, the enumeration elements start with wd.)
And in some languages you might need to specify the object model namespace, such as Word. Other languages, such as C#, need both: Microsoft.Office.Interop.Word.WdColor.wdColorBlue. (Or, if a using statement has been defined, like using Word = Microsoft.Office.Interop.Word then it would be Word.WdColor.wdColorBlue.)
When it comes to researching and using parts of the object model that aren't in code snippets, the VBA IDE does provide some tools that compliment what you can glean from the official Language References.
Object Browser The VBA IDE Object Browser can be accessed using F2 in the IDE (Alt+F11 to get to the IDE from within an Office application). Type the term you want to look at into the "Find" box and you'll get a list of corresponding object model elements. Clicking on an element brings up more information in the window below. At the very bottom is a gray section with additional details. For example, the "parent" Enumeration namespace for an Enum member such as wdColorBlue. Or a method's signature. (If you ever notice a conflict between Language Reference information and what you see in the Object Browser, the content of the Object Browser is correct!)
Immediate Window. You can also query information using the VBA
Asked in February 2016Viewed 2,639 timesVoted 5Answered 1 times