Word Automation: WdUnits-constants

How can I use parameters in functions that in VBA require Constants?? (example: how to do this in C/AL: Selection.Next(Unit:=wdWord, Count:=1).Select [?])



From VBA - Help (German) Unit Variant optional. Dabei kann es sich um eine der folgenden WdUnits-Konstanten handeln: wdCharacter, wdWord, wdSentence, wdParagraph, wdSection, wdStory, wdCell, wdColumn, wdRow oder wdTable. Wenn Ausdruck ein Selection-Objekt zurückgibt, können Sie auch wdLine verwenden. Der Standardwert lautet wdCharacter

In most of the cases you can remove each constant with an integer (starting from 1). In your case this should work: //sometimes it is better to use variables x:= 2; //Unit:=wdWord; y:= 1; //Count; Selection.Next(x,y); Hint: Go to Word VBA. View ‘Objektkatalog’. Search for ‘unit’ - you will find ‘Word -WdUnits’. Click on ‘wdWort’. Now you can see the constant ‘2’ in the lower right window. But you can also count this in the normal VBA help (see above). bye André