Created
July 7, 2024 19:45
-
-
Save eugrus/9e477e74e9eb75f1cfa0e8b5c53c8782 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ([string]$pathToInsertableTemplate) | |
$msword = [System.Runtime.Interopservices.Marshal]::GetActiveObject("Word.Application") | |
$doc = $msword.ActiveDocument | |
$insertableTemplate = $msword.Documents.Open($pathToInsertableTemplate) | |
$insertableTemplate.Content.Copy() | |
$selection = $msword.Selection | |
$selection.Paste() | |
$insertableTemplate.Close([ref]$false) | |
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($insertableTemplate) | Out-Null | |
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($msword) | Out-Null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment