|
|
|
date: Sat, 16 Aug 2008 22:06:06 +0200,
group: microsoft.public.word.vba.beginners
back
Select CheckBox FormField hell ;-)
Dear Word-experts,
I have this 'simple' scheme of checkbox form fields. For reasons of
document lay-out, the days must be on top.
=============
Mo Tu We Th Fr
AM [] [] [] [] []
PM [] [] [] [] []
=============
No problem to use if you'd like to fill in from left to right.
But ... I want the order to be Mo-AM, Mo-PM, Tu-Am, Tu-PM, We-AM
etc. So vertical by weekday. This must haven been done before ;-).
So I added ExitMacros specifying the next field to select. The '*'
marks.
=============
Mo Tu We Th Fr
AM []* []* []* []* []*
PM []* []* []* []* []
=============
This turns the scheme into living 'hell'.
I read the article "How to validate the contents of a form field in
a Word form" by Dave Rado. It acknolewdges the problem but doesn't
give a final solution for me. Probably because I deal with a
sequence of fields.
In simple situations (not a sequence of ExitMacro-fields)
=============
ActiveDocument.FormFields("chkBeschikbaarMaMi").PREVIOUS.Select
=============
works.
I also tried to deactivate the <Tab> by
=============
Sub Dummy()
End Sub
Sub Crazy()
'Deactivate the <Tab>-key
CustomizationContext = ActiveDocument
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyTab), _
KeyCategory:=wdKeyCategoryCommand, Command:="Dummy"
'Select the proper field
ActiveDocument.FormFields("chkBeschikbaarMaMi").Select
'Reactivate the <Tab>-key
CustomizationContext = ActiveDocument
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyTab), _
KeyCategory:=wdKeyCategoryDisable, Command:=""
End Sub
=============
This type of code works in a regular document by not while using
fields: error code ###### ...
My workaround: jump to a dummy field (indicated in the scheme by
a '|', formatted as Hidden text. The 'demon Word' by itself
selects the next true field.
=============
Mo Tu We Th Fr
AM []* |[]* |[]* |[]* |[]*
PM |[]* |[]* |[]* |[]* |[]
=============
This 'works' but, as this will have been done before: what is
the proper approach?
A working sample of the document can be downloaded from:
http://www.fhvzelm.com/?page=cursus
Met vriendelijke groeten,
Frans H. van Zelm
fhvzelm@doge.nl
www.fhvzelm.com
date: Sat, 16 Aug 2008 22:06:06 +0200
author: F.H. van Zelm
Re: Select CheckBox FormField hell ;-)
Use a two row, 6 column table construction (without borders if desired)
Mo Tu We Th Fr
AM¶ []¶ []¶ []¶ []¶ []¶
PM [] [] [] [] []
with the AM and the PM and the corresponding checkboxes all in one row, with the enter key pressed where indicated by the ¶ in the above layout. Then, without anything else being required, pressing the tab key will move the selection through the formfields in the order that you are after.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"F.H. van Zelm" wrote in message news:uNZEft9$IHA.3648@TK2MSFTNGP02.phx.gbl...
Dear Word-experts,
I have this 'simple' scheme of checkbox form fields. For reasons of
document lay-out, the days must be on top.
=============
Mo Tu We Th Fr
AM [] [] [] [] []
PM [] [] [] [] []
=============
No problem to use if you'd like to fill in from left to right.
But ... I want the order to be Mo-AM, Mo-PM, Tu-Am, Tu-PM, We-AM
etc. So vertical by weekday. This must haven been done before ;-).
So I added ExitMacros specifying the next field to select. The '*'
marks.
=============
Mo Tu We Th Fr
AM []* []* []* []* []*
PM []* []* []* []* []
=============
This turns the scheme into living 'hell'.
I read the article "How to validate the contents of a form field in
a Word form" by Dave Rado. It acknolewdges the problem but doesn't
give a final solution for me. Probably because I deal with a
sequence of fields.
In simple situations (not a sequence of ExitMacro-fields)
=============
ActiveDocument.FormFields("chkBeschikbaarMaMi").PREVIOUS.Select
=============
works.
I also tried to deactivate the <Tab> by
=============
Sub Dummy()
End Sub
Sub Crazy()
'Deactivate the <Tab>-key
CustomizationContext = ActiveDocument
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyTab), _
KeyCategory:=wdKeyCategoryCommand, Command:="Dummy"
'Select the proper field
ActiveDocument.FormFields("chkBeschikbaarMaMi").Select
'Reactivate the <Tab>-key
CustomizationContext = ActiveDocument
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyTab), _
KeyCategory:=wdKeyCategoryDisable, Command:=""
End Sub
=============
This type of code works in a regular document by not while using
fields: error code ###### ...
My workaround: jump to a dummy field (indicated in the scheme by
a '|', formatted as Hidden text. The 'demon Word' by itself
selects the next true field.
=============
Mo Tu We Th Fr
AM []* |[]* |[]* |[]* |[]*
PM |[]* |[]* |[]* |[]* |[]
=============
This 'works' but, as this will have been done before: what is
the proper approach?
A working sample of the document can be downloaded from:
http://www.fhvzelm.com/?page=cursus
Met vriendelijke groeten,
Frans H. van Zelm
fhvzelm@doge.nl
www.fhvzelm.com
date: Sun, 17 Aug 2008 08:04:06 +1000
author: Doug Robbins - Word MVP
|
|