Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 1.7 KB

Excel.Hyperlink.CreateNewDocument.md

File metadata and controls

52 lines (35 loc) · 1.7 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Hyperlink.CreateNewDocument method (Excel)
vbaxl10.chm536086
vbaxl10.chm536086
Excel.Hyperlink.CreateNewDocument
902914b7-08ea-0839-13e1-8fc7e7192675
04/26/2019
medium

Hyperlink.CreateNewDocument method (Excel)

Creates a new document linked to the specified hyperlink.

Syntax

expression.CreateNewDocument (FileName, EditNow, Overwrite)

expression 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 worksheet and then loads the document into Microsoft Excel for editing. The document is called Report.xls, and it overwrites any file of the same name in the \Server1\Annual folder.

With Worksheets(1) 
 Set objHyper = _ 
 .Hyperlinks.Add(Anchor:=.Range("A10"), _ 
 Address:="\\Server1\Annual\Report.xls") 
 objHyper.CreateNewDocument _ 
 FileName:="\\Server1\Annual\Report.xls", _ 
 EditNow:=True, Overwrite:=True 
End With

[!includeSupport and feedback]