A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Add checkboxes with macro in Merge document?



 
 
Thread Tools Display Modes
  #1  
Old October 18th, 2005, 07:10 PM
Bryan L
external usenet poster
 
Posts: n/a
Default Add checkboxes with macro in Merge document?

Our 3rd-party management system stores Word templates within its database.
We use their proprietary interface for selecting Form Letters to merge (or
edit), but the merged document or template itself opens up in Word. I
mention this at the outset in case it affects any answers.

We frequently merge customer data into these form letters, and that works
fine. I'm trying something new, however. I'd like to incorporate simple
checkboxes into some of the Form Letters used internally by employees to
submit, for example, a check request. Some of the relevant data pulls from
the customer's account, but there are quite a few other mulitple-choice
questions the user has to answer, and checkboxes would be ideal for that.

I found a fairly simple macro that works in conjuction with bookmarks to
make checkboxes behave the way I want. It uses bookmarks to define a group
of checkboxes so that only one checkbox within the group can be checked.
Marking a checkbox within the group causes all other checkboxes in the group
to deselect, so only one box at a time can be selected. This macro works
fine, but I have two problems:

1. When I save the template and then merge a document into it, the
merged document does not contain the bookmarks defined in the template.
However, if I open the template directly for editing, the bookmarks are
still there.

2. Locking the form (so the checkboxes will work) also locks the user
out of the other cells in the table. (For the sake of a clean layout that's
easy to read and navigate I've laid out the document using tables.) I think
this means one of two things: I either need to leave sections that must be
user-editable out of tables, or I need to add form fields to the cells where
I want them to enter data so when I lock the form, they have access to the
form fields I've created. Is there another option for me? Can I
selectively UN-protect the specific table cells that I wish users to use for
data entry? Do I need to similarly unprotect cells that contain merge
fields?

Thanks in advance,

Bryan



  #2  
Old October 19th, 2005, 01:45 PM
cynjor312
external usenet poster
 
Posts: n/a
Default Add checkboxes with macro in Merge document?

Bryan L:
I know you were expecting an answer but your post caught my eye regarding
checkboxes. I am working on our application, placed form fields where info is
needed to be filled in and noticed my checkboxes can both be checked at the
same time. i don't want this. how did you get it to where you can only select
one while the others are deselected? NOTE: I am working with Word 2000

"Bryan L" wrote:

Our 3rd-party management system stores Word templates within its database.
We use their proprietary interface for selecting Form Letters to merge (or
edit), but the merged document or template itself opens up in Word. I
mention this at the outset in case it affects any answers.

We frequently merge customer data into these form letters, and that works
fine. I'm trying something new, however. I'd like to incorporate simple
checkboxes into some of the Form Letters used internally by employees to
submit, for example, a check request. Some of the relevant data pulls from
the customer's account, but there are quite a few other mulitple-choice
questions the user has to answer, and checkboxes would be ideal for that.

I found a fairly simple macro that works in conjuction with bookmarks to
make checkboxes behave the way I want. It uses bookmarks to define a group
of checkboxes so that only one checkbox within the group can be checked.
Marking a checkbox within the group causes all other checkboxes in the group
to deselect, so only one box at a time can be selected. This macro works
fine, but I have two problems:

1. When I save the template and then merge a document into it, the
merged document does not contain the bookmarks defined in the template.
However, if I open the template directly for editing, the bookmarks are
still there.

2. Locking the form (so the checkboxes will work) also locks the user
out of the other cells in the table. (For the sake of a clean layout that's
easy to read and navigate I've laid out the document using tables.) I think
this means one of two things: I either need to leave sections that must be
user-editable out of tables, or I need to add form fields to the cells where
I want them to enter data so when I lock the form, they have access to the
form fields I've created. Is there another option for me? Can I
selectively UN-protect the specific table cells that I wish users to use for
data entry? Do I need to similarly unprotect cells that contain merge
fields?

Thanks in advance,

Bryan




  #3  
Old October 19th, 2005, 03:55 PM
Charles Kenyon
external usenet poster
 
Posts: n/a
Default Add checkboxes with macro in Merge document?

What you are talking about is what Word calls an "online form." For more
about online forms, follow the links at
http://addbalance.com/word/wordwebresources.htm#Forms or
http://word.mvps.org/FAQs/Customizat...nTheBlanks.htm especially Dian
Chapman's series of articles. You may also want to look at
http://www.word.mvps.org/FAQs/TblsFl...nesInForms.htm.

See especially
http://word.mvps.org/FAQs/TblsFldsFm...FmFldChbxs.htm.

Hope this helps,
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
"cynjor312" wrote in message
...
Bryan L:
I know you were expecting an answer but your post caught my eye regarding
checkboxes. I am working on our application, placed form fields where info
is
needed to be filled in and noticed my checkboxes can both be checked at
the
same time. i don't want this. how did you get it to where you can only
select
one while the others are deselected? NOTE: I am working with Word 2000

"Bryan L" wrote:

Our 3rd-party management system stores Word templates within its
database.
We use their proprietary interface for selecting Form Letters to merge
(or
edit), but the merged document or template itself opens up in Word. I
mention this at the outset in case it affects any answers.

We frequently merge customer data into these form letters, and that works
fine. I'm trying something new, however. I'd like to incorporate simple
checkboxes into some of the Form Letters used internally by employees to
submit, for example, a check request. Some of the relevant data pulls
from
the customer's account, but there are quite a few other mulitple-choice
questions the user has to answer, and checkboxes would be ideal for that.

I found a fairly simple macro that works in conjuction with bookmarks to
make checkboxes behave the way I want. It uses bookmarks to define a
group
of checkboxes so that only one checkbox within the group can be checked.
Marking a checkbox within the group causes all other checkboxes in the
group
to deselect, so only one box at a time can be selected. This macro works
fine, but I have two problems:

1. When I save the template and then merge a document into it, the
merged document does not contain the bookmarks defined in the template.
However, if I open the template directly for editing, the bookmarks are
still there.

2. Locking the form (so the checkboxes will work) also locks the user
out of the other cells in the table. (For the sake of a clean layout
that's
easy to read and navigate I've laid out the document using tables.) I
think
this means one of two things: I either need to leave sections that must
be
user-editable out of tables, or I need to add form fields to the cells
where
I want them to enter data so when I lock the form, they have access to
the
form fields I've created. Is there another option for me? Can I
selectively UN-protect the specific table cells that I wish users to use
for
data entry? Do I need to similarly unprotect cells that contain merge
fields?

Thanks in advance,

Bryan






  #4  
Old October 19th, 2005, 04:05 PM
Charles Kenyon
external usenet poster
 
Posts: n/a
Default Add checkboxes with macro in Merge document?

Protected forms and mailmerge do not work well together. As you've
discovered, merging a document strips bookmarks.

If you are merging a single data record, the following procedure may work.

Unprotect your template.
Create a new document based on the template and link it to your merge source
record.
Display the merged data in your new document but do not merge to the printer
or to a document.
Lock your document for forms and use the checkboxes.
Unlock the document if you need to do more editing.
Print and save the new document.

I also unlink merge fields and make the document a non-merge document using
a macro:

Sub UnmergeThis()
' Written 29 August 2002 by Charles Kyle Kenyon
' Updated 23 September 2002 to attach normal.dot
' Remove merge codes from document, remove from merge status
'
' Test for template - in template only disconnect from merge but leave
merge fields active
'
On Error Resume Next
If ActiveDocument.Type = wdTypeTemplate Then
'
' Test for merge document - do not run if not merge document
'
If MergeTest() = False Then ' private function call
Exit Sub
End If
'
' Disconnect template from merge data
ActiveDocument.MailMerge.MainDocumentType = wdNotAMergeDocument
Application.CommandBars("MergeK").Visible = False
Exit Sub
End If
'
' Test for merge document - do not run if not merge document
'
If MergeTest() = False Then
Exit Sub
End If
'
Dim oField As Field
Dim vMsgBoxResponse As Variant
Dim sUserTemplates As String
'
' Double check with user because permanent operation
'
vMsgBoxResponse = MsgBox(Prompt:= _
"This will disconnect this document from the merge file." _
& vbCrLf & "This cannot be undone." & vbCrLf & vbCrLf _
& "Continue?", Buttons:= _
vbQuestion + vbYesNo + vbDefaultButton1, _
Title:="Continue?")
If vMsgBoxResponse vbYes Then
MsgBox Prompt:="No changes made to document.", _
Title:="Merge connection still active."
Exit Sub
End If
'
' OK to continue
'
Application.ScreenUpdating = False
'
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldMergeField Then
oField.Unlink
End If
Next oField
'
ActiveDocument.MailMerge.MainDocumentType = wdNotAMergeDocument
'
' Disconnect from template - attach normal.dot
'
sUserTemplates =
Application.Options.DefaultFilePath(wdUserTemplate sPath)
If Right(sUserTemplates, 1) "\" Then
sUserTemplates = sUserTemplates & "\"
End If
' sUserTemplates =
Application.Options.DefaultFilePath(wdUserTemplate sPath) & "\"
With ActiveDocument
.UpdateStylesOnOpen = False
.AttachedTemplate = sUserTemplates & "Normal.dot"
End With
Application.ScreenUpdating = True
Application.ScreenRefresh
'
End Sub

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Bryan L" wrote in message
...
Our 3rd-party management system stores Word templates within its database.
We use their proprietary interface for selecting Form Letters to merge (or
edit), but the merged document or template itself opens up in Word. I
mention this at the outset in case it affects any answers.

We frequently merge customer data into these form letters, and that works
fine. I'm trying something new, however. I'd like to incorporate simple
checkboxes into some of the Form Letters used internally by employees to
submit, for example, a check request. Some of the relevant data pulls
from the customer's account, but there are quite a few other
mulitple-choice questions the user has to answer, and checkboxes would be
ideal for that.

I found a fairly simple macro that works in conjuction with bookmarks to
make checkboxes behave the way I want. It uses bookmarks to define a
group of checkboxes so that only one checkbox within the group can be
checked. Marking a checkbox within the group causes all other checkboxes
in the group to deselect, so only one box at a time can be selected. This
macro works fine, but I have two problems:

1. When I save the template and then merge a document into it, the
merged document does not contain the bookmarks defined in the template.
However, if I open the template directly for editing, the bookmarks are
still there.

2. Locking the form (so the checkboxes will work) also locks the user
out of the other cells in the table. (For the sake of a clean layout
that's easy to read and navigate I've laid out the document using tables.)
I think this means one of two things: I either need to leave sections
that must be user-editable out of tables, or I need to add form fields to
the cells where I want them to enter data so when I lock the form, they
have access to the form fields I've created. Is there another option for
me? Can I selectively UN-protect the specific table cells that I wish
users to use for data entry? Do I need to similarly unprotect cells that
contain merge fields?

Thanks in advance,

Bryan





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I mail merge to EMAIL from MS Word AND add a pdf attachment Lily@Insight Mailmerge 24 January 15th, 2007 10:33 PM
Save document without saving macro within it? Dave Peterson General Discussion 0 November 17th, 2004 12:42 AM
Bookmarks are not retained during Mail Merge Latha Mailmerge 22 June 16th, 2004 08:53 PM
Lost text fields in merge CGiannini General Discussion 5 June 4th, 2004 10:23 PM
Using a Excel macro or VB to call up a WORD mail merge document Bob Reynolds Worksheet Functions 0 January 7th, 2004 07:25 PM


All times are GMT +1. The time now is 06:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.