Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I toggle this Code - to Stamp and to UnStamp?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I toggle this Code - to Stamp and to UnStamp?
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 -- Regards, Tom Ogilvy "JMay" wrote in message news:hIvLb.70604$hf1.45492@lakeread06... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Command button to toggle worksheet event code on / off? | Excel Discussion (Misc queries) | |||
Toggle Button | Excel Discussion (Misc queries) | |||
Toggle button | Excel Discussion (Misc queries) | |||
toggle between worksheets? | Excel Discussion (Misc queries) | |||
How to toggle | Excel Programming |