Add a path and filename to document in word 2011 for mac

broken image

We begin by creating an instance of the Word.Application object and setting the Visible property to True we then add a document and create an instance of the Selection object. Like we said, way easier than trying to combine multiple files in a single text file.

broken image

ObjSelection.InsertFile(“C:\Scripts\Software.txt”) ObjSelection.TypeText “Software Inventory” ObjSelection.InsertFile(“C:\Scripts\Hardware.txt”) ObjSelection.TypeText “Hardware Inventory” Let’s take a look at a script that imports a pair of text files (C:\Scripts\Hardware.txt and C:\Scripts\Software.txt): Set objWord = CreateObject(“Word.Application”) And InsertFile isn’t limited to opening just text files: if it’s a type of file that Word can handle, then InsertFile can open it and insert it in your document.

broken image

That’s because the Word Selection object has a method – InsertFile – that does one thing and one thing only: it opens up a specified file and inserts it into the current document. Believe it or not it’s actually easier to insert files into a Microsoft Word document than it is to insert a text file into another text file. How can I insert files into a Word document? Hey, Scripting Guy! Awhile back you showed people how they could combine several text files into a single file.