M
Michael Petrilla
I wish to insert two checkboxes, side by side on the same line, in the third
column of a three column table. The Caption for one checkbox should be
"YES" and the other one should be "NO". I can insert one checkbox, but when
the code runs for the second checkbox, the first box gets overwritten. How
do I place the second checkbox next to the first checkbox on the same line?
I also want a small space between the two, say three spaces. Here is my
code. Thank you.
Sub insertInlineShapesCheckbox()
Dim myCheckbox1, myCheckbox2
'shifts insertion point to first tab
Selection.TypeText Text:=vbTab
'insert first checkbox
Set myCheckbox1 = Selection.InlineShapes.AddOLEControl(ClassType:="Forms.
CheckBox.1")
With myCheckbox1.OLEFormat.Object
.TextAlign = 3
.Alignment = 0
.Width = 43
.Caption = "YES"
.FontName = "Arial"
.FontSize = 11
End With
'Selection.TypeText Text:=" "
'Selection.TypeText Text:=vbTab
'insert second checkbox
Set myCheckbox2 = Selection.InlineShapes.AddOLEControl(ClassType:="Forms.
CheckBox.1")
With myCheckbox2.OLEFormat.Object
.TextAlign = 3
.Alignment = 0
.Width = 43
.Caption = "NO"
.FontName = "Arial"
.FontSize = 11
End With
End Sub
url:http://www.ureader.com/gp/1022-1.aspx
column of a three column table. The Caption for one checkbox should be
"YES" and the other one should be "NO". I can insert one checkbox, but when
the code runs for the second checkbox, the first box gets overwritten. How
do I place the second checkbox next to the first checkbox on the same line?
I also want a small space between the two, say three spaces. Here is my
code. Thank you.
Sub insertInlineShapesCheckbox()
Dim myCheckbox1, myCheckbox2
'shifts insertion point to first tab
Selection.TypeText Text:=vbTab
'insert first checkbox
Set myCheckbox1 = Selection.InlineShapes.AddOLEControl(ClassType:="Forms.
CheckBox.1")
With myCheckbox1.OLEFormat.Object
.TextAlign = 3
.Alignment = 0
.Width = 43
.Caption = "YES"
.FontName = "Arial"
.FontSize = 11
End With
'Selection.TypeText Text:=" "
'Selection.TypeText Text:=vbTab
'insert second checkbox
Set myCheckbox2 = Selection.InlineShapes.AddOLEControl(ClassType:="Forms.
CheckBox.1")
With myCheckbox2.OLEFormat.Object
.TextAlign = 3
.Alignment = 0
.Width = 43
.Caption = "NO"
.FontName = "Arial"
.FontSize = 11
End With
End Sub
url:http://www.ureader.com/gp/1022-1.aspx