vba - where can we get documentation for component object model -


i want com documentation if there want know little things com. example, common rule, converting below code word application

documents.add

to com as

oword.documents.add

is easy adding object variable oword. how can know converting below vba

selection.font.color = 16711680

to below com

oword.selection.font.color := wdcolorblue := 16711680

how := wdcolorblue := 16711680 comes?

i thought should either := wdcolorblue or := 16711680. couldn't imagine := wdcolorblue := 16711680.

where can find these little details?

reference url: https://autohotkey.com/board/topic/120360-changing-font-type-color-size-with-1-set-of-code-across-all-ms-office-programs/

"translating" office object models native vba use in other language environments can tricky. reading code snippets in other language way started - "feel" how looks.

one important aspect notice in languages it's necessary fully qualify "namespace" comes. enumeration such wdcolorblue, example, "parent" enumeration may necessary, wdcolor. (note "parent" enumeration in word start wd, enumeration elements start wd.)

and in languages might need specify object model namespace, such word. other languages, such c#, need both: microsoft.office.interop.word.wdcolor.wdcolorblue. (or, if using statement has been defined, using word = microsoft.office.interop.word word.wdcolor.wdcolorblue.)

when comes researching , using parts of object model aren't in code snippets, vba ide provide tools compliment can glean official language references.

  • object browser vba ide object browser can accessed using f2 in ide (alt+f11 ide within office application). type term want @ "find" box , you'll list of corresponding object model elements. clicking on element brings more information in window below. @ bottom gray section additional details. example, "parent" enumeration namespace enum member such wdcolorblue. or method's signature. (if ever notice conflict between language reference information , see in object browser, content of object browser correct!)
  • immediate window. can query information using vba ide immediate window (ctrlf+g). type question mark (?) followed term - wdcolorblue, example - press enter , enum integer value displayed. there's intellisense while typing in immediate window.

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -