February 18th, 2015

PowerTip: Use PowerShell ISE for Standard Enumerations

Doctor Scripto
Scripter

Summary: Use the Windows PowerShell ISE to use enumeration values.

Hey, Scripting Guy! Question How can I use the Windows PowerShell ISE to use the standard enumeration types to write a
           Word automation script?

Hey, Scripting Guy! Answer Cast the string as a type, and store the returned value in a variable. Each enumeration value
           will be available as a static property. Here is an example:

$HeaderFooterIndex = "microsoft.office.interop.word.WdHeaderFooterIndex" -as [type]

$HeaderFooterIndex::wdHeaderFooterFirstPage

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.