D
David
Apologies if there's a better group I could post to.
Word2000 + Win2000 or XP
I have a couple of mail merge documents that are recreations of some
forms from our company. Each contain some checkboxes. I employed the
method using AutoText/Macrobutton outlined by several posts I've seen to
toggle those checkboxes with my mouse -- with a couple of twists.
In order to use a single mouse click AND have the ability to use the
method on a file that I've created via 'Merge to new document', I have to
not only had to Attach the template to each of the two documents, but Add
the template to make it global and add some code to the template's
ThisDocument/Open routine to fire the template when I open either parent
or merged document and make single clicking work. Here are the routines
for that template as they stand.
ThisDocument:
Private Sub Document_Open()
AddIns("C:\data\word\CheckBox.dot").Installed = True
Options.ButtonFieldClicks = 1
End Sub
ChkBox Module Subs:
Sub CheckIt()
ActiveDocument.AttachedTemplate.AutoTextEntries("Checked Box").Insert
Where:=Selection.Range
End Sub
Sub UncheckIt()
ActiveDocument.AttachedTemplate.AutoTextEntries("Unchecked Box").Insert
Where:=Selection.Range
End Sub
Everything works exactly as desired, so I guess I shouldn't complain, but
there is one tiny cosmetic flaw. When I open the menu Insert | AutoText,
I see TWO entries each for 'Checked Box' and 'Unchecked Box'. Aargh!!!
I wrestled all weekend to adjust the file placement and code to both load
the template and fire the Document_Open routine so I could eliminate the
need to Attach the template to each file and still have the ability to
single click in all files and reduce the AutoText entries to a single
instance. No matter what I tried, there was always one piece of the
puzzle missing.
Any help? I want to have my cake and eat it too!!
One caveat: I want the template to remain in C:\Data\Word for two
reasons: 1) I backup this folder to two other machines daily and 2) since
the AddIns() line requires the full path, if I placed it in Word\Startup,
that's a looong path and unique for each machine.
Word2000 + Win2000 or XP
I have a couple of mail merge documents that are recreations of some
forms from our company. Each contain some checkboxes. I employed the
method using AutoText/Macrobutton outlined by several posts I've seen to
toggle those checkboxes with my mouse -- with a couple of twists.
In order to use a single mouse click AND have the ability to use the
method on a file that I've created via 'Merge to new document', I have to
not only had to Attach the template to each of the two documents, but Add
the template to make it global and add some code to the template's
ThisDocument/Open routine to fire the template when I open either parent
or merged document and make single clicking work. Here are the routines
for that template as they stand.
ThisDocument:
Private Sub Document_Open()
AddIns("C:\data\word\CheckBox.dot").Installed = True
Options.ButtonFieldClicks = 1
End Sub
ChkBox Module Subs:
Sub CheckIt()
ActiveDocument.AttachedTemplate.AutoTextEntries("Checked Box").Insert
Where:=Selection.Range
End Sub
Sub UncheckIt()
ActiveDocument.AttachedTemplate.AutoTextEntries("Unchecked Box").Insert
Where:=Selection.Range
End Sub
Everything works exactly as desired, so I guess I shouldn't complain, but
there is one tiny cosmetic flaw. When I open the menu Insert | AutoText,
I see TWO entries each for 'Checked Box' and 'Unchecked Box'. Aargh!!!
I wrestled all weekend to adjust the file placement and code to both load
the template and fire the Document_Open routine so I could eliminate the
need to Attach the template to each file and still have the ability to
single click in all files and reduce the AutoText entries to a single
instance. No matter what I tried, there was always one piece of the
puzzle missing.
Any help? I want to have my cake and eat it too!!
One caveat: I want the template to remain in C:\Data\Word for two
reasons: 1) I backup this folder to two other machines daily and 2) since
the AddIns() line requires the full path, if I placed it in Word\Startup,
that's a looong path and unique for each machine.