CreateNewDocument Method 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

This example creates a new Avery 2160 minilabel document using a predefined address.

addr = "Dave Edson" & vbCr & "123 Skye St." _
    & vbCr & "Our Town, WA  98004"
Application.MailingLabel.CreateNewDocument _
    Name:="2160 mini", Address:=addr, ExtractAddress:=False

This example creates a new Avery 5664 shipping-label document using the selected text as the address.

addr = Selection.Text
Application.MailingLabel.CreateNewDocument _
    Name:="5664", Address:=addr, _
    LaserTray:=wdPrinterUpperBin

This example creates a new self-adhesive-label document using the EnvelopeAddress bookmark text as the address.

If ActiveDocument.Bookmarks.Exists("EnvelopeAddress") = True Then
    Application.MailingLabel.CreateNewDocument _
        Name:="Self Adhesive Tab 1 1/2""", ExtractAddress:=True
End If