473,479 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Check Boxes in Word

Hello,

I am trying to open a Word template, fill some fields, and mark some
check boxes as checked. Here is the code I am using:

' Launch Word and load the report template
Set objWord = New Word.Application
objWord.Documents.Add _
Application.CurrentProject.Path & "\PEFA_Field_Sheet.dot"
objWord.Visible = True

Set rst = New ADODB.Recordset
rst.Open strSQL, CurrentProject.Connection

rst.MoveFirst

' Update Word template
With objWord.ActiveDocument.Bookmarks
If Not IsNull(rst.Fields("USGS_Quad")) Then
.Item("USGS_Quad").Range.Text = rst.Fields("USGS_Quad")
End If
If Not IsNull(rst.Fields("park_code")) Then
.Item("park_code").Range.Text = rst.Fields("park_code")
End If
End With

objWord.ActiveDocument.formfield("Ledge_cliff").Ch eckBox.Value
= True

The form opens and the fields fill as expected, but Access crashes on
the last line with the error message "Object doesn't support this
property or method."

I have triple checked the name on the template checkbox and I have
tried all manner of different syntax in the instruction, but no luck.

Can anyone help?

Thanks.

ParkMan

Mar 20 '06 #1
1 4627
On 20 Mar 2006 14:28:12 -0800, "ParkMan" <ru*************@nps.gov>
wrote:

Open Word, open your template, turn on the macro recorder
(tools/macro/record new macro), check a couple of checkboxes, and stop
recording. Inspect the macro - you'll find the methods and properties
to use.

In rare cases you may have several versions of Word installed, you may
be using version-specific functionality, and you may need to be
specific about what object to create. E.g.:
set objWord = CreateObject("Word.Application.11") 'version 11 = 2003

-Tom.

Hello,

I am trying to open a Word template, fill some fields, and mark some
check boxes as checked. Here is the code I am using:

' Launch Word and load the report template
Set objWord = New Word.Application
objWord.Documents.Add _
Application.CurrentProject.Path & "\PEFA_Field_Sheet.dot"
objWord.Visible = True

Set rst = New ADODB.Recordset
rst.Open strSQL, CurrentProject.Connection

rst.MoveFirst

' Update Word template
With objWord.ActiveDocument.Bookmarks
If Not IsNull(rst.Fields("USGS_Quad")) Then
.Item("USGS_Quad").Range.Text = rst.Fields("USGS_Quad")
End If
If Not IsNull(rst.Fields("park_code")) Then
.Item("park_code").Range.Text = rst.Fields("park_code")
End If
End With

objWord.ActiveDocument.formfield("Ledge_cliff").Ch eckBox.Value
= True

The form opens and the fields fill as expected, but Access crashes on
the last line with the error message "Object doesn't support this
property or method."

I have triple checked the name on the template checkbox and I have
tried all manner of different syntax in the instruction, but no luck.

Can anyone help?

Thanks.

ParkMan


Mar 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2418
by: Edward | last post by:
The following html / javascript code produces a simple form with check boxes. There is also a checkbox that 'checks all' form checkboxes hotmail style: <html> <head> <title></title> </head>...
6
1025
by: Tony Roost | last post by:
I have created a test VB.Net form that will use MS Word to check the spelling of text in an input box The test application runs without a problem and I quit the word application at the end of the...
2
3210
by: jimi_xyz | last post by:
Sorry if this isn't the correct group, i don't think there is a group for straight HTML. I am trying to create a type of search engine. There are two radio buttons at the top, in the middle there...
32
5071
by: deko | last post by:
I'm trying to create an MSI in VS.NET that will check for installed Office System components - so my MDE will only install if requirements are met. I'm thinking about using VBScript to inspect...
2
3731
by: Craig M | last post by:
Hi, I have a form, frmInvoices and a subform, frmInvoicesSub. On the parent form, i have a "print report" button, that prints a report depending on an ID on the parent form. Each record in...
2
27706
by: Travis.Box | last post by:
I have an MS Access userform with 16 Check Boxes. Each of the checkboxes has a different option value, which coincides with the Check Box name (eg. cb01.OptionValue = 1). At the bottom of the...
1
1613
by: Java Kumar | last post by:
Hi Friends, I have a form which contains elements such as check boxes,text box,text area ., Problem is in Check boxes. By default, Check boxes are unchecked and text boxes...
7
1726
by: phpretard | last post by:
I have columns named -email- rookie- -coach- -minor- R1. email has an address rookie has a value of the word "yes" R2. email has an address coach is empty R3. email has an address minor has a...
27
5839
kcdoell
by: kcdoell | last post by:
Hello: I am a newbie with Java coding... I have a form that I created in Word. Within that form it had a place where the user could selected certain states or all states via a checkbox. I used...
0
6899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6719
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6847
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4757
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2980
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2970
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
555
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.