Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to remove/delete a sheet object with given name in VBscript ?
I would like to loop over all sheet objects, find its name, and delete it if the name equals some given value ,.
Old topic but if someone are looking for a similar solution....
This macro will remove object based on user input
Sub DeleteObject
set s=ActiveDocument.Sheets("Main")
name = ActiveDocument.GetApplication.InputBox("Enter name of the object?")
Objects = ActiveDocument.ActiveSheet.GetSheetObjects
For j = lBound(Objects) To uBound(Objects)
set obj = Objects(j)
IF obj.GetCaption.Name.v = name Then
s.SheetObjects(j).Close
else
end if
next
End Sub
Hi Robert
Thank you very much!
It will help me a lot !
Regards