Update on Office error

Back in this post https://richardspowershellblog.wordpress.com/2012/10/15/powershell-3-and-word/

I showed that this code

$word = New-Object -ComObject “Word.application”           
$word.visible = $true           
$doc = $word.Documents.Add()           
$word.Selection.Font.Name = “Cambria”           
$word.Selection.Font.Size = “20”           
$word.Selection.Font.Name = “Calibri”           
$word.Selection.Font.Size = “12”           
$word.Selection.TypeText(“The best scripting language in the world!”)           
$file = “c:\test1.doc”           

Wouldn’t work because of an error in the way [REF] was treated. I had a comment left on the post saying it worked on PowerShell v4.

I’ve tested on PowerShell v4 on Windows 8.1 with Office 2013. It works. I can’t vouch for other combinations but it looks the problem has been resolved.

If you have the opportunity please try it and let me know if it doesn’t work for your particular combination of PowerShell v4, Windows and Office

This entry was posted in Office 2013, PowerShell v4, Windows 8.1. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s