markpalinux
asked on
How to Change MS Word Template - Headers with Powershell
I have a problem that I am trying to use Powershell to resolve.
It has to do with MS Word Office templates used as headers. File servers were changes and the old UNC path no longer exists.
Microsoft gave examples for VBA and VBscript how to make changes, however I cannot find these properties with Powershell,
I tried to look at the Office Object Model and use powershell's Get-Member but could not figure things out.
I am aware that DNS and an Alias can change things but for security we have strict name checking in place.
Documents that have attached templates take a long time to open in Word 2002 and in Word 2003
http://support.microsoft.com/kb/830561
Here are the lines I am referring to.
Set objDoc = Documents.Open(strFilePath & strFileName)
Set objTemplate = objDoc.AttachedTemplate
Set dlgTemplate = Dialogs(wdDialogToolsTempl ates)
strPath = dlgTemplate.Template
So far I have:
$Document = "C:\Temp\Donation Form.doc"
$Word = New-Object -comobject Word.Application
$OpenDoc = $Word.Documents.Open($Docu ment)
$objTemplate = $OpenDoc.AttachedTemplate
It has to do with MS Word Office templates used as headers. File servers were changes and the old UNC path no longer exists.
Microsoft gave examples for VBA and VBscript how to make changes, however I cannot find these properties with Powershell,
I tried to look at the Office Object Model and use powershell's Get-Member but could not figure things out.
I am aware that DNS and an Alias can change things but for security we have strict name checking in place.
Documents that have attached templates take a long time to open in Word 2002 and in Word 2003
http://support.microsoft.com/kb/830561
Here are the lines I am referring to.
Set objDoc = Documents.Open(strFilePath
Set objTemplate = objDoc.AttachedTemplate
Set dlgTemplate = Dialogs(wdDialogToolsTempl
strPath = dlgTemplate.Template
So far I have:
$Document = "C:\Temp\Donation Form.doc"
$Word = New-Object -comobject Word.Application
$OpenDoc = $Word.Documents.Open($Docu
$objTemplate = $OpenDoc.AttachedTemplate
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Excellent. Thank you.
ASKER
Thanks , that link helped me find this:
https://www.experts-exchange.com/questions/23022794/VB-SCript-to-Change-MS-Word-Document-Template-Location.html