Upravit

Sdílet prostřednictvím


Hyperlink.CreateNewDocument method (Word)

Creates a new document linked to the specified hyperlink.

Syntax

expression.CreateNewDocument (FileName, EditNow, Overwrite)

expression Required. A variable that represents a 'Hyperlink' object.

Parameters

Name Required/Optional Data type Description
FileName Required String The file name of the specified document.
EditNow Required Boolean True to have the specified document open immediately in its associated editing environment. The default value is True.
Overwrite Required Boolean True to overwrite any existing file of the same name in the same folder. False if any existing file of the same name is preserved and the FileName argument specifies a new file name. The default value is False.

Example

This example creates a new document based on the new hyperlink in the first document and then loads the new document into Microsoft Word for editing. The document is called Overview.doc, and it overwrites any file of the same name in the \\Server1\Annual folder.

With Documents(1) 
 Set objHyper = _ 
 .Hyperlinks.Add(Anchor:=Selection.Range, _ 
 Address:="\\Server1\Annual\Overview.doc") 
 objHyper.CreateNewDocument _ 
 FileName:="\\Server1\Annual\Overview.doc", _ 
 EditNow:=True, Overwrite:=True 
End With

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.