Workbook.Delete
Use this function to delete the current item from the workbook.
Syntax | Parameters | Return value |
---|---|---|
- | This function has no parameters. | This function does not return a value. |
SVB Example
Deleting an item from 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 the file adstudy.sta into the root folder 'of the workbook as the first child wb.InsertFile(Path & _ "\examples\datasets\adstudy.sta",wb.Root,scWorkbookFirstChild) 'sets the workbook to visible wb.Visible = True 'message box posts a message, pausing execution of the macro 'allows the spreadsheet to be seen before it is deleted MsgBox("The current object will be deleted from the workbook") 'deletes the current item, adstudy.sta, from the workbook wb.Delete End Sub
Copyright © 2020. Cloud Software Group, Inc. All Rights Reserved.