Showing posts with label Manya. Show all posts
Showing posts with label Manya. Show all posts

Wednesday, November 25, 2015

PowerShell & Microsoft Word 2016 : Get the name of Active printer in Word 2016

 

In the previous blog  post, we have see that how can we enable / disable the view of the recent files.

If you have some users, those move from one regional office to other, and if they keep complaining about that their word is too slow and often crash while give print, then it's the issue with printer setup, they may have the  active printer which sits in another office which the user may visit once or often.

My task was to find the active printer in the Microsoft Word. I thought it may be difficult, but rather it was easy, I just need to use the ActivePrinter property of the our $word variable.

$word.ActivePrinter

 

Printer_1

 

Printer_0

That's all, the complete code is :

$word = New-Object -ComObject "Word.Application"

$word.Visible = $true

$word.ActivePrinter

 

Thanks for your time and see you in next blog post.

 

Aman Dhally - Manya Kaur

 

With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.

Tuesday, November 24, 2015

PowerShell & Microsoft Word 2016 : Enabling / Disabling display of recent files in Word 2016 using PowerShell.

 

In the previous blog post, we have seem that how can we show Word Clipboard using PowerShell.

Now, the things are getting heated . Now my next task is to enable and disable the display of recent files in the Word 2016.

Crazy! No!

But, I manage to do it.

By default, Word 2016, show you the list of Recent files. I am task to make it off using PowerShell.

before disabled

And I manage to do this, by using.....

$word.DisplayRecentFiles = $false ; 

Simple and Cool no!

In the below screenshot you can see that, there is no recently opened files.

recent-disabled

The complete code is .

$word = New-Object -ComObject "Word.Application"

$word.Visible = $true

$word.DisplayRecentFiles = $false ; 

 

:)  hell Yah!

 

Note : The above only works if you open Word document using code, if you open word separately, you will see the recent files.

 

Aman Dhally - Manya Kaur

With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.

Thursday, November 19, 2015

PowerShell & Microsoft Word 2016 : Setting Zoom view levels of Word 2016 document.

 

Now, from here the things has started complicated, One of the "Word Wizard" in my office asked me to open a document in a particular zoom type.

I hope  you have noticed a zoom bar in word before, by moving you are zoom-in-and-zoom-out a document.  This was the tricky question, but after a research, I have manage to do it.

It' is only one liner :)

In the below line of code, I am setting a zoom view to 200%. Remember the property is in percentage.

$word.Application.ActiveWindow.View.Zoom.Percentage = 200;

That's all, rest of the code is same.

The complete code is :

$word = New-Object -ComObject "Word.Application"

$word.Visible = $true

$myFile = "C:\Users\aman.dhally\Documents\PolyCom-ThreeParty Conefrence.docx"

$word.Application.Documents.open($myFile) | Out-Null

$word.Application.ActiveWindow.View.Zoom.Percentage = 200;

It's cool no?

NOTE :  The Zoom only works, if you have an document already open, otherwise, you will get an exception error.

Aman Dhally - Manya Kaur

giphy (1)

With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.