Can I toggle this Code - to Stamp and to UnStamp?

J

JMay

Below code is working just fine; I 've assigned it to a icon on my
Formatting Toolbar.
At present it is a one-directional Stamping of the Text "DRAFT....
I'de like to be able to click on my button "a second time" and have the text
"DRAFT..." disappear; then click again, and have it appear,
((Toggle-type)) - Can this be done?
If how, how would I modify (the code) it?
TIA,

Sub DraftStamp()
With ActiveSheet.Shapes.AddTextEffect( _
msoTextEffect1, "D R A F T" & Chr(10) & "ISSUED " & Date,
"Arial Black", _
24#, msoFalse, msoFalse, Left:=300, Top:=5)
With .Fill
.Visible = msoTrue
.Solid
.ForeColor.SchemeColor = 10
.Transparency = 0.2
End With
With .Line
.Weight = 0.75
.DashStyle = msoLineSolid
.Style = msoLineSingle
.Transparency = 0#
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 0, 0)
.BackColor.RGB = RGB(255, 255, 255)
End With
.LockAspectRatio = msoTrue
.Height = 60#
.Width = 175#
.Rotation = 0#
End With
ActiveSheet.Protect _
DrawingObjects:=True, _
Contents:=False, _
Scenarios:=False
End Sub
 
T

Tom Ogilvy

Assuming you don't have other wordart on the sheet:

Sub DraftStamp()
For Each shp In ActiveSheet.Shapes
If InStr(1, shp.Name, "wordart", vbTextCompare) Then
ActiveSheet.Unprotect
shp.Delete
Exit Sub
End If
Next
With ActiveSheet.Shapes.AddTextEffect( _
msoTextEffect1, "D R A F T" & Chr(10) & "ISSUED " _
& Date, "Arial Black", _
24#, msoFalse, msoFalse, Left:=300, Top:=5)
With .Fill
.Visible = msoTrue
.Solid
.ForeColor.SchemeColor = 10
.Transparency = 0.2
End With
With .Line
.Weight = 0.75
.DashStyle = msoLineSolid
.Style = msoLineSingle
.Transparency = 0#
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 0, 0)
.BackColor.RGB = RGB(255, 255, 255)
End With
.LockAspectRatio = msoTrue
.Height = 60#
.Width = 175#
.Rotation = 0#
End With
ActiveSheet.Protect _
DrawingObjects:=True, _
Contents:=False, _
Scenarios:=False
End Sub
 

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