S
sspittell
I have used the following code to insert a jpeg file. But cannot figur
out how to delete the graphic, to clear the sheet.
Dim pic As Picture
Dim varInput As String
varInput = InputBox("Please Type in the path and Name to you
Electronic Signature, C:\mysig.jpg")
Sheets("chgMemo").Select
Range("I49").Select
'Unprotect Sheet
ActiveSheet.Select
ActiveCell.Activate
ActiveSheet.Unprotect password:="1234"
Set pic = ActiveSheet.Pictures.insert(varInput)
pic.Top = Range("I49:W49").Top
pic.Left = Range("I49:W49").Left
pic.Width = Range("I49:W49").Width
pic.Height = Range("I49:W49").Height
'Protect sheet
ActiveSheet.Select
ActiveCell.Activate
Range("AA49").Select
Range("AA49").Value = Now()
ActiveSheet.Protect password:="1234"
Here is what I think is close to correct
Private Sub cmdClear_Click()
' Define a For-Each loop of all the drawing objects on the
' active worksheet.
For Each DrawObj In ActiveSheet.DrawingObjects
' Define Cell_Ref as the top left cell address of eac
Drawing
' Object.
Range("I49:W49") = DrawObj.TopLeftCell.Address
' Define a For-Each loop of all the cells with the range
' Print_Area.
For Each Cell In Range("I49:W49")
' If the Object's top left cell address is the same a
a
' cell in the print range.
If Range("I49:W49") = Cell.Address Then
' Then delete the object.
DrawObj.Delete
' End the IF statement.
End If
' Loop through next cell.
Next Cell
' Loop through next DrawObj.
Next DrawObj
End Su
out how to delete the graphic, to clear the sheet.
Dim pic As Picture
Dim varInput As String
varInput = InputBox("Please Type in the path and Name to you
Electronic Signature, C:\mysig.jpg")
Sheets("chgMemo").Select
Range("I49").Select
'Unprotect Sheet
ActiveSheet.Select
ActiveCell.Activate
ActiveSheet.Unprotect password:="1234"
Set pic = ActiveSheet.Pictures.insert(varInput)
pic.Top = Range("I49:W49").Top
pic.Left = Range("I49:W49").Left
pic.Width = Range("I49:W49").Width
pic.Height = Range("I49:W49").Height
'Protect sheet
ActiveSheet.Select
ActiveCell.Activate
Range("AA49").Select
Range("AA49").Value = Now()
ActiveSheet.Protect password:="1234"
Here is what I think is close to correct
Private Sub cmdClear_Click()
' Define a For-Each loop of all the drawing objects on the
' active worksheet.
For Each DrawObj In ActiveSheet.DrawingObjects
' Define Cell_Ref as the top left cell address of eac
Drawing
' Object.
Range("I49:W49") = DrawObj.TopLeftCell.Address
' Define a For-Each loop of all the cells with the range
' Print_Area.
For Each Cell In Range("I49:W49")
' If the Object's top left cell address is the same a
a
' cell in the print range.
If Range("I49:W49") = Cell.Address Then
' Then delete the object.
DrawObj.Delete
' End the IF statement.
End If
' Loop through next cell.
Next Cell
' Loop through next DrawObj.
Next DrawObj
End Su