Export (0) Print
Expand All
Expand Minimize

Range.InsertFile Method

Office 2007
Inserts all or part of the specified file.

Syntax

expression.InsertFile(FileName, Range, ConfirmConversions, Link, Attachment)

expression   Required. A variable that represents a Range object.

Parameters

NameRequired/OptionalData TypeDescription
FileNameRequiredStringThe path and file name of the file to be inserted. If you don't specify a path, Word assumes the file is in the current folder.
RangeOptionalVariantIf the specified file is a Word document, this parameter refers to a bookmark. If the file is another type (for example, a Microsoft Excel worksheet), this parameter refers to a named range or a cell range (for example, R1C1:R3C4).
ConfirmConversionsOptionalVariantTrue to have Word prompt you to confirm conversion when inserting files in formats other than the Word Document format.
LinkOptionalVariantTrue to insert the file by using an INCLUDETEXT field.
AttachmentOptionalVariantTrue to insert the file as an attachment to an e-mail message.

Example

This example uses an INCLUDETEXT field to insert the TEST.DOC file at the end of the current document.

Visual Basic for Applications
ActiveDocument.Range.Collapse Direction:=wdCollapseEnd
ActiveDocument.Range.InsertFile FileName:="C:\TEST.DOC", Link:=True



Community Additions

ADD
Show:
© 2015 Microsoft