brilliant
brilliant

Reputation: 2863

VBScript: Appending a word to the MS "Word" 2003 document

Here is a short code that opens my "fox.doc" :

Set wd = CreateObject("Word.Application")
wd.Visible = True
Set doc = wd.Documents.Open("c:\fox.doc")

I need to add only one word "bottle" in the end of this document (after it has been opened). Which lines should I add to my small vbs script for that?

Upvotes: 0

Views: 934

Answers (1)

Fionnuala
Fionnuala

Reputation: 91356

You can learn a lot by recording macros in Word and then making the, usually small, changes that will make the code work in VBScript.

Set r = doc.Words.Last
r.InsertAfter (" bottle")

Upvotes: 1

Related Questions