This code works but I get a ton of unneeded data. Is there an easier way to go to a specified page in a Word document or a way to suppress all the unwanted info. Here I'm going to page 2:
# create a word object
$w = New-Object -ComObject Word.Application
# make it visible
$w.visible = $true
# create a document object by opening a file
$doc = $w.Documents.Open('\\servername\Users\Christian.Bahnsen\Desktop\ToDo Folder\word\splitTest\batch721extract.docx')
# create a selection object
$objSelection = $w.Selection
# parameters equate to (wdGoToPage,wdGoToAbsolute,pageNumber)
$objSelection.GoTo(1,1,2)
This takes me to page 2 but I'm getting a ton of unwanted info in the PowerShell ISE, e.g.,
PS C:\Users\Christian.Bahnsen> $mySelection.GoTo(1,1,2)
Text :
FormattedText : System.__ComObject
Start : 2099
End : 2099
Font : Microsoft.Office.Interop.Word.FontClass
Duplicate : System.__ComObject
StoryType : 1
Tables : System.__ComObject
Words : System.__ComObject
Sentences : System.__ComObject
Characters : System.__ComObject
Footnotes : System.__ComObject
Endnotes : System.__ComObject
Comments : System.__ComObject
...
and so forth for several pages
So is there an easier way to go to a specific page or is there a way to quash all the info posh is spitting back at me?
Thanks in advance for any assistance.
Christian Bahnsen