C
coach_mikey
Hi all.
I have code that successully (thanks Perry!) allows a user to
simultaneously view a Word document and add customized textboxes to the
document via a Userform. The userform contains dropdowns and a text
entry box. Based on what the user enters/selects on the userform, the
customized textbox displays that information.
But now I need to allow the user to edit the contents of that textbox,
but using the same userform. How can I assign a generic click-event to
these textboxes which have been inserted into the word document?
Also, any suggestions on how to allow the user to easily
minimize/maximize the textboxes with single clicks?
Below is the code that creates each textbox. Thanks!
Private Sub cmdNewComment_Click()
Set myTextBox = ActiveDocument.Shapes.AddTextbox( _
Orientation:=msoTextOrientationHorizontal, _
Left:=InchesToPoints(-1), _
Top:=InchesToPoints(0), _
Width:=InchesToPoints(0.8), _
Height:=InchesToPoints(1.5), _
Anchor:=Selection.Range)
With myTextBox.Fill
.ForeColor.RGB = RGB(0, 350, 0)
.BackColor.RGB = RGB(250, 120, 250)
End With
myTextBox.AutoShapeType = msoShapeRectangle
With myTextBox.TextFrame.TextRange
.Text = "Comment #1" & vbCrLf & "XYZ Issue"
.Font.Name = "Arial"
.Font.Size = 8
.Bold = True
myTextBox.TextFrame.WordWrap = True
myTextBox.TextFrame.AutoSize = True
End With
Selection.Range.HighlightColorIndex = wdTeal
End Sub
I have code that successully (thanks Perry!) allows a user to
simultaneously view a Word document and add customized textboxes to the
document via a Userform. The userform contains dropdowns and a text
entry box. Based on what the user enters/selects on the userform, the
customized textbox displays that information.
But now I need to allow the user to edit the contents of that textbox,
but using the same userform. How can I assign a generic click-event to
these textboxes which have been inserted into the word document?
Also, any suggestions on how to allow the user to easily
minimize/maximize the textboxes with single clicks?
Below is the code that creates each textbox. Thanks!
Private Sub cmdNewComment_Click()
Set myTextBox = ActiveDocument.Shapes.AddTextbox( _
Orientation:=msoTextOrientationHorizontal, _
Left:=InchesToPoints(-1), _
Top:=InchesToPoints(0), _
Width:=InchesToPoints(0.8), _
Height:=InchesToPoints(1.5), _
Anchor:=Selection.Range)
With myTextBox.Fill
.ForeColor.RGB = RGB(0, 350, 0)
.BackColor.RGB = RGB(250, 120, 250)
End With
myTextBox.AutoShapeType = msoShapeRectangle
With myTextBox.TextFrame.TextRange
.Text = "Comment #1" & vbCrLf & "XYZ Issue"
.Font.Name = "Arial"
.Font.Size = 8
.Bold = True
myTextBox.TextFrame.WordWrap = True
myTextBox.TextFrame.AutoSize = True
End With
Selection.Range.HighlightColorIndex = wdTeal
End Sub