Workbook.InsertNew
Use this function to insert a new document or folder into the workbook.
| Syntax | Parameters | Return value |
|---|---|---|
Function Workbook.InsertNew( _
ItemType As Variant, _
ItemReference As WorkbookItem, _
Optional Placement As WorkbookPlacement = scWorkbookDefaultPlacement) As WorkbookItem
|
|
SVB Example
Inserting a new item into a workbook
Option Base 1
Option Explicit
Sub Main
Dim wb As Workbook
'assigns the new workbook to the object wb
Set wb = Workbooks.New("WB Example")
'Inserts a new report document, into the root folder of the
'workbook as the first child
wb.InsertNew(scWorkbookItemTypeReport,wb.Root,scWorkbookFirstChild)
'sets the workbook to visible
wb.Visible = True
End Sub