Go Back   Access World Forums > Apps and Windows > Word

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 06-01-2012, 12:46 AM   #1
jesse
Newly Registered User
 
Join Date: Jul 2010
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
jesse is on a distinguished road
setting all formfields in a column to true with vba

Hi,

I have to fill out long word forms regularly and I made a macro to check all checkboxes in a column in a table (see code below). It works fine except when a cell has more than one checkbox, then only the first checkbox in a cell gets checked.

The problem in my code is that when I update a checkbox, the selection is reset (which is logical) but that also automatically deletes/resets the ffs collection (which I find very weird) so the remaining checkboxes don't get checked. Anyone got a solution?

Sub checkcol()

Dim col As Column
Dim cl As Cell
Dim ffs As FormFields
Dim ff As FormField

If Selection.Information(wdWithInTable) Then
Set col = Selection.Columns(1)

For Each cl In col.Cells
cl.Select
Set ffs = Selection.FormFields

For Each ff In ffs
ff.CheckBox.Value = True
Next ff
Next cl
End If
End Sub

jesse is offline   Reply With Quote
Reply

Tags
vba , word

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting True/False on a CheckBox alktrigger Modules & VBA 7 07-17-2009 12:34 PM
Setting a Yes/No field to true pwdpwd Modules & VBA 7 06-04-2009 09:08 PM
Setting autostart property to true for WMP ActiveX control dannewestis Modules & VBA 0 09-22-2006 03:30 PM
Setting table field to true when exporting to csv dannewestis Queries 1 09-21-2006 05:31 AM
Setting AllowAdditions = True and False jaydwest Forms 3 11-26-2003 03:52 PM




All times are GMT -8. The time now is 03:41 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World