![]() I then want to select the current pane in Word so I can begin writing data to it. I am keeping the output of this saved to another variable that will be used later on. We do this by calling the Documents.Add() method. But we don’t actually have a document loaded yet to start writing. To make Word visible, we have to set the Visibility of the object to $True. One thing that you might note is that we can’t see Word opened up, even though the process is actually active. Now I have created my object as shown in the image below. $Word = New-Object -ComObject Word.Application Like any COM object, we must use New-Object with the –ComObject parameter to tell PowerShell that we are loading up a Com object. I will be using Word 2013 in this article, so your mileage may vary if using older versions. This first article will dip our toes into creating the Word Com object, looking at sending text to Word and adjusting some of the various fonts and styles to give you a stepping stone on what you can do.
0 Comments
Leave a Reply. |