Table of contents
TOC
折叠目录
展开目录

NewFile 对象 (办公室)NewFile Object (Office)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

表示可用几个 Microsoft Office 应用程序中新建项目_任务窗格中列出的项。Represents items listed on the New _Item task pane available in several Microsoft Office applications.

请注意 已通过 Microsoft Office 流畅的用户界面的新功能区组件取代某些 Microsoft Office 应用程序中的命令栏使用。有关更多信息,请搜索帮助关键字"功能区"。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, search Help for the keyword "ribbon."

注解Remarks

下表显示了用于访问NewFile对象中每个应用程序的属性。The following table shows the property to use to access the NewFile object in each of the applications.

示例Example

使用Add方法将新项添加到新建项_任务窗格。下面的示例将项添加到 Word 的新建文档任务窗格中。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

使用Remove方法可以从新建项目_任务窗格中移除项。下面的示例删除以上示例从 Word 的新建文档任务窗格中添加的文档。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

请注意 下面的示例是个字,但可以更改为上面列出的任何新建文档属性并使用相应的应用程序中的代码。Note The examples below are for Word, but you can change the NewDocument property for any of the properties listed above and use the code in the corresponding application.

方法Methods

名称Name
AddAdd
RemoveRemove

属性Properties

名称Name
ApplicationApplication
CreatorCreator

另请参阅See also

其他资源Other resources

对象模型引用Object Model Reference

© 2018 Microsoft