gtbreps_2
12-30-2016, 07:39 AM
I'm trying to add a text box shape. I have the code written to add the text box where I want it and how I want it formatted.
Dim Message As Integer
Dim messagebx As Shape
Message = MsgBox("Would you like to include a message to the client?", vbYesNo + vbQuestion, "Message")
If Message = vbYes Then
Range("C12:L12").Merge
rows("12:22").insert
Set messagebx = Shapes.AddTextbox(msoTextOrientationHorizontal, 22, 165, 473, 185)
messagebx.TextFrame.Characters.Text = "[Insert Message]"
messagebx.TextFrame.Characters.Font.Size = 9
messagebx.TextFrame.Characters.Font.Name = "Arial"
messagebx.Line.Visible = msoFalse
Else
'do nothing
End If
After this and a bunch of other code is performed, my sheet can be updated and the code re-ran. But if I re-run the code, this text box is replaced with a new blank box. I'd like it to just stay using an error handling statement or something. I'm just not familiar with error handling.
Dim Message As Integer
Dim messagebx As Shape
Message = MsgBox("Would you like to include a message to the client?", vbYesNo + vbQuestion, "Message")
If Message = vbYes Then
Range("C12:L12").Merge
rows("12:22").insert
Set messagebx = Shapes.AddTextbox(msoTextOrientationHorizontal, 22, 165, 473, 185)
messagebx.TextFrame.Characters.Text = "[Insert Message]"
messagebx.TextFrame.Characters.Font.Size = 9
messagebx.TextFrame.Characters.Font.Name = "Arial"
messagebx.Line.Visible = msoFalse
Else
'do nothing
End If
After this and a bunch of other code is performed, my sheet can be updated and the code re-ran. But if I re-run the code, this text box is replaced with a new blank box. I'd like it to just stay using an error handling statement or something. I'm just not familiar with error handling.