- #Microsoft word set up variables update
- #Microsoft word set up variables code
- #Microsoft word set up variables tv
The commented code would end up looking like this: ‘ colFields.Update
#Microsoft word set up variables update
That’s fine just comment out (or remove) the following line of code and your script will not update all the fields when it opens the document. On the other hand, some of you might want to retrieve the value of the fields at the time the document was last saved. By calling the Update method we get the latest, most up-to-the-minute value for each field in the document we’re assuming that this is what most of you will want to do. Once we have the collection in hand we call the Update method to update each of these fields. Well, that was easy enough, wasn’t it? Like taking candy from a baby.Īfter we open the document we then use the following line of code to retrieve a collection of all the fields in that document: Set colFields = objDoc.Fields We then use this line of code to open the file C:\Scripts\Test.doc: Set objDoc = (“C:\Scripts\Test.doc”) To begin with, we create an instance of the Word.Application object and then set the Visible property to True that gives us a running instance of Microsoft Word that we can see onscreen.
Let’s meander through the code and see if we can figure out how this all works.
#Microsoft word set up variables tv
Also, the playing pieces have been updated for the Banking Edition these pieces now include: a Segway personal transporter (which is nice after all, most of us will never see a Segway in real life) a space shuttle a flat-screen TV a baseball cap a dog in handbag (yes, a handbag) and – the piece everyone will likely fight over – a tin of Altoids.īut it doesn’t really matter after all, who has time for games anyway? Not us, not when we need to write a script that can retrieve field values from a Microsoft Word document: Set objWord = CreateObject(“Word.Application”) Technically, the game doesn’t use just any old debit card: it’s a Visa debit card. There are certain people even the Scripting Guys shouldn’t make jokes about. Sitting there with a huge pile of cash in front of you is absolutely the greatest feeling in the world. (And all the while you saying, “Tell you what, you give me your two yellow properties and you won’t owe me a thing.”) Having him simply swipe his debit card doesn’t sound like much fun at all. After all, there are few things in life more satisfying than watching one of your brothers grimly counting out every last Monopoly dollar he has, desperately hoping to reach the $1000 in rent he owes you. In case you’re wondering, the Scripting Guy who writes this column found this disturbing.
What was interesting (or disturbing, depending on your point of view) is that this version of Monopoly does away with cash instead, players use debit cards and an ATM-like machine to keep track of their winnings. You know, the other night the Scripting Guy who writes this column was watching TV when he saw an ad for a new Monopoly game: Monopoly, the Electronic Banking Edition. How can I write a script that retrieves the current values for these fields? Hey, Scripting Guy! I have a bunch of Word documents that include fields like LastSavedBy.