Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 1.98 KB

Office.NewFile.md

File metadata and controls

60 lines (40 loc) · 1.98 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
NewFile object (Office)
vbaof11.chm235000
vbaof11.chm235000
Office.NewFile
6f53ced5-4488-b67f-ca1f-729aeb790eb1
01/22/2019
medium

NewFile object (Office)

Represents items listed on the New Item task pane available in several Microsoft Office applications.

Note

The use of CommandBars in some Microsoft Office applications has been superseded by the new ribbon component of the Microsoft Office Fluent user interface. For more information, see Overview of the Office Fluent ribbon.

Remarks

Use the Application property or the Creator property to access the NewFile object in each of the applications.

Example

Use the Add method to add a new item to the New Item task pane. The following example adds an item to Word's New Document task pane.

Sub AddNewDocToTaskPane() 
    Application.NewDocument.Add FileName:="C:\NewDocument.doc", _ 
        Section:=msoNew, DisplayName:="New Document" 
    CommandBars("Task Pane").Visible = True  
End Sub

Use the Remove method to remove an item from the New Item task pane. The following example removes the document added in the above example from Word's New Document task pane.

Sub RemoveDocFromTaskPane() 
    Application.NewDocument.Remove FileName:="C:\NewDocument.doc", _ 
        Section:=msoNew, DisplayName:="New Document" 
    CommandBars("Task Pane").Visible = True  
End Sub

Note

These examples are for Word, but you can change the NewDocument property for any of the properties listed and use the code in the corresponding application.

See also

[!includeSupport and feedback]