Removing Drawn Object

B

Brian Matlack

Hello!

When I "Save As" to a new location, is there a code that would allow me
to remove a specified drawn object or control button?

I have a template workbook that the user can print instructions (word
document) from a button. After they "Save As" to whatever new location
they choose, the file path is no longer valid and I would like the
button to disappear.

Maybe there is a better way?

Thanks for any help or direction!
 
C

colofnature

Put:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

If SaveAsUI Then Sheet1.Shapes("CommandButton1").Delete

End Sub

in the ThisWorkbook code module of your workbook (substitute the
correct names for the sheet and commandbutton in question).

Or you could change the file path to a UNC path (i.e.
"\\servername\volume\directory\file")


Col
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top