Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Check Box code not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Susan B. Quinn - 28 Apr 2006 08:10 GMT
I thought I had it worked out but it keeps coming up with an error when I run
my dialog box.

I have check boxes that I want the user to select to insert certain blocks
of text. There can be any combination of the six check boxes.

This is the abbreviated version of the code

Private Sub cmdok_Click()
' Insert information entered into the dialog box
' close dialog box and go to body of the letter to start typing

With ActiveDocument.AttachedTemplate

If chkb_ei.Value = True Then
.Bookmarks("ei_bm").Range.InsertAutoText ("EI_Assess")
End If

End With

If cb_pat = "four" Then
.Bookmarks("pp2_testpara").Range.InsertAutoText ("pp2_four_tests")
End If

End With

Unload frmbuilder
End Sub

It seemed to make logical sense but it keeps throwing me back to the code
with a 438 error message object doesn't support the property

Help would be appreciated. And advice on how to get a better understanding
of VB would be appreciated. I trawl the web but think I need to understand
what I am doing better.

Susan
Helmut Weber - 28 Apr 2006 08:54 GMT
Hi Susan,

> With ActiveDocument.AttachedTemplate
>    If chkb_ei.Value = True Then
>    .Bookmarks("ei_bm").Range.InsertAutoText ("EI_Assess")
>    End If
> End With

You are trying to insert an autotext entry
into the attached template.

You might want something like:
with activedocument
' ...
end with

Signature

Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000

Susan B. Quinn - 04 May 2006 06:26 GMT
Helmut isn't that what I have done?? I tried setting it up on each If
statement but that changed nothing.

I know that I have used the same code with command buttons and it works.

Completely lost Susan

> Hi Susan,
>
[quoted text clipped - 11 lines]
> ' ...
> end with
Tony Jollans - 04 May 2006 11:59 GMT
Hi Completely lost Susan,

No, that isn't what you have done :)

This line ...

   With ActiveDocument.AttachedTemplate

says work with the *Template*, when what you probably want is ...

   With ActiveDocument

which says work with the *Document*.

--
Enjoy,
Tony

> Helmut isn't that what I have done?? I tried setting it up on each If
> statement but that changed nothing.
[quoted text clipped - 24 lines]
> > "red.sys" & chr(64) & "t-online.de"
> > Word 2002, Windows 2000
David - 28 Apr 2006 08:58 GMT
have you tried stepping through it?
Which object does not support the property?

>I thought I had it worked out but it keeps coming up with an error when I run
>my dialog box.
[quoted text clipped - 33 lines]
>
>Susan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.