ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing Drawn Object (https://www.excelbanter.com/excel-programming/363401-removing-drawn-object.html)

Brian Matlack[_91_]

Removing Drawn Object
 

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!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=548916


colofnature[_48_]

Removing Drawn Object
 

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


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=548916


Brian Matlack[_93_]

Removing Drawn Object
 

Works Great Col!! Thanks for your time and help!

--
Brian Matlac
-----------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...nfo&userid=350
View this thread: http://www.excelforum.com/showthread.php?threadid=54891



All times are GMT +1. The time now is 02:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com