Workbook.InsertObject
Use this function to insert the specified object into the workbook.
SVB Example
Inserting an 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") Dim M As Macro 'assigns the new macro to the object M Set M = Macros.New("Example Macro") 'inserts the object, M, into the root folder of the workbook As the last child wb.InsertObject(M,wb.Root,scWorkbookLastChild) 'sets the workbook to visible wb.Visible = True End Sub
Copyright © 2020. Cloud Software Group, Inc. All Rights Reserved.