I am creating a Word template document with PowerShell (Word 2016 build 16.0.6741.2021, 32-bit and PowerShell 5.0.10586.122 running on Windows 10 Pro build 1511). I create a new style based on the "Heading 1" style. The only difference that I would like from "Heading 1" style is to remove the numbering. With the following PowerShell code I'm able to create the new style based on "Heading 1":
$word = New-Object -ComObject Word.Application; $word.Documents.Add() | Out-Null; $style = $word.ActiveDocument.Styles.Add("New Style Name"); $style.BaseStyle = $word.ActiveDocument.Styles.Item('Heading 1'); $style.NextParagraphStyle = $word.ActiveDocument.Styles.Item('Normal');With VBA the following code will remove the numbering from the template:
Me.Styles.Item("New Style Name").LinkToListTemplate NothingHowever this doesn't work with PowerShell when using $Null value or any other value I tried as it expects a ListTemplate object:
$style.LinkToListTemplate $Null;
How can the numbering removed with PowerShell and the Word.Application ComObject?
Thanks in advance,
Dennis van den Akker