H
Heinz
Hi together,
i want to place some checkboxes in a new document using a
Template. The checkboxes are placed in a table. The Code
for the checkboxes i want to place in ThisDocument. When i
run the Template windword will crash with the errormesage:
The instruction at "<address>" referended memory
at "<adress>". The memory could not be read.
I can write any comment to ThisDocument. But when i use
the code for the checkboxes, this happens. The code of the
template is:
' ******************************************************
Public Sub subfillLine(txtTask, txtTaskMarker)
Dim shp
Selection.InsertAfter txtTask ' This is only Text
Selection.MoveRight unit:=wdCell
ActiveDocument.VBProject.VBComponents"ThisDocument").CodeMo
dule.AddFromString _
" Sub chk" & txtTaskMarker & "_Click()" _
& vbCr & " MsgBox " & """" & "Hello World" & """" _
& vbCr & " End Sub"
Set shp =
Selection.InlineShapes.AddOLEControlClassType:="Forms.Check
Box.1")
With shp.OLEFormat.Object
.Name = "chk" & txtTaskMarker
.Width = 10
.Height = 10
.Caption = ""
End With
Selection.MoveRight unit:=wdCell
Selection.Bookmarks.Add "book" & txtTaskMarker
Selection.MoveDown unit:=wdLine
Selection.MoveLeft unit:=wdCell
Selection.MoveLeft unit:=wdCell
End Sub
' ******************************************************
Perhaps somone knows, what i' m doing wrong or has another
workaround.
Thx 4 help
i want to place some checkboxes in a new document using a
Template. The checkboxes are placed in a table. The Code
for the checkboxes i want to place in ThisDocument. When i
run the Template windword will crash with the errormesage:
The instruction at "<address>" referended memory
at "<adress>". The memory could not be read.
I can write any comment to ThisDocument. But when i use
the code for the checkboxes, this happens. The code of the
template is:
' ******************************************************
Public Sub subfillLine(txtTask, txtTaskMarker)
Dim shp
Selection.InsertAfter txtTask ' This is only Text
Selection.MoveRight unit:=wdCell
ActiveDocument.VBProject.VBComponents"ThisDocument").CodeMo
dule.AddFromString _
" Sub chk" & txtTaskMarker & "_Click()" _
& vbCr & " MsgBox " & """" & "Hello World" & """" _
& vbCr & " End Sub"
Set shp =
Selection.InlineShapes.AddOLEControlClassType:="Forms.Check
Box.1")
With shp.OLEFormat.Object
.Name = "chk" & txtTaskMarker
.Width = 10
.Height = 10
.Caption = ""
End With
Selection.MoveRight unit:=wdCell
Selection.Bookmarks.Add "book" & txtTaskMarker
Selection.MoveDown unit:=wdLine
Selection.MoveLeft unit:=wdCell
Selection.MoveLeft unit:=wdCell
End Sub
' ******************************************************
Perhaps somone knows, what i' m doing wrong or has another
workaround.
Thx 4 help