Trouble inserting autotext

A

Angie M.

Hi,

I have the following code:

If boxState = True Then
Dim rngDoc3 As Range
Set rngDoc3 = ActiveDocument.Range.Bookmarks("bkState").Range
ActiveDocument.AttachedTemplate.AutoTextEntries("3State").Insert _
Where:=rngDoc3, RichText:=True
Else
oDoc.Bookmarks("bkState").Range.Paragraphs(1).Range.Delete
End If

that doesn't work. I want it to recognize if the boxState is checked or
not, if so, insert my autotext called 3State at the bookmark bkState,
otherwise I want it to delete the paragraph where the bookmark sits. What am
I doing wrong?

Thanks for the help
 
J

Jean-Guy Marcil

Angie M. was telling us:
Angie M. nous racontait que :
Hi,

I have the following code:

If boxState = True Then
Dim rngDoc3 As Range
Set rngDoc3 = ActiveDocument.Range.Bookmarks("bkState").Range
ActiveDocument.AttachedTemplate.AutoTextEntries("3State").Insert _
Where:=rngDoc3, RichText:=True
Else
oDoc.Bookmarks("bkState").Range.Paragraphs(1).Range.Delete
End If

that doesn't work. I want it to recognize if the boxState is checked
or not, if so, insert my autotext called 3State at the bookmark
bkState, otherwise I want it to delete the paragraph where the
bookmark sits. What am I doing wrong?

Thanks for the help

What is "boxState"?
 
A

Angie M.

Good morning,

boxState is my checkbox named "boxState". I have about 7 different
autotext entries that are optional, depending on what the user selects on the
form. thanks for any help!
 
J

Jean-Guy Marcil

Angie M. was telling us:
Angie M. nous racontait que :
Good morning,

boxState is my checkbox named "boxState". I have about 7 different
autotext entries that are optional, depending on what the user
selects on the form. thanks for any help!

If "boxstate" is a formfield checkbox, here is how you can check its value:

If ActiveDocument.FormFields("boxState").CheckBox.Value Then
MsgBox "My Checkbox is True."
Else
MsgBox "My Checkbox is False."
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top