Envelopes and Protected Forms

G

Guest

I am creating a series of documents to simplify the work of a business owner
who is less than computer literate. One such document is a protected form, a
cover letter with fields for the name and address, along with four other
pieces of information.

Up until now, any time she typed a letter, this woman either wrote an
envelope by hand or, less frequently, used a separate envelope template. I
have since modified the envelope wizard on her computer to use her graphic
return address and have shown her how to use it. This works fine when she
types a letter on her stationery template, but not for forms.

On a protected form, which this does need to be for ease of use and to keep
her from accidentally corrupting the format, the envelope button (which I
added to her toolbar) and menu options are grayed out. The only way to create
an envelope is to unprotect the form.

If I attach a blank envelope to the form, is there any way to have the
envelope fields automatically populated with data from the letter? Is there a
field function or macro I could use which would take the name and address she
types on the letter and use the same information on the envelope, all without
any additional steps for her? Alternately, is there a way to make the
envelope wizard available on a locked form?

The solution would need to be a simple one for her to use.

Thanks,

-J.
 
C

Charles Kenyon

I use the following macro with a protected form. It uses my envelope
template (a separate template) rather than the wizard and populates the
macrobutton fields on the new envelope with information from the form.

Sub KenyonBillEnvelope()
'
' KenyonBillEnvelope Macro
' Macro written 7/5/02 by Charles Kyle Kenyon
' "&chr(10)&"New envelope based on Kenyon Envelope form
' Calls WorkgroupPath Function (below)
' Calls SelectIt subroutine (below)
'
Dim sTemplatesPath As String
Dim sName As String
Dim sAddress As String
Dim sCSZ As String
'
sTemplatesPath = WorkGroupPath & "Letters & Faxes\"
'
' Get address info from bill
'
sName = ActiveDocument.FormFields("Name").Result
sAddress = ActiveDocument.FormFields("Street").Result
sCSZ = ActiveDocument.FormFields("CSZ").Result
'
' Create new envelope document and go to place for inserting address
Documents.Add Template:= _
sTemplatesPath & "Kenyon Legal Envelope.dot", _
NewTemplate:=False
SelectIt (2)
'
'
Selection.Text = sName
SelectIt (2)
Selection.Text = sAddress
SelectIt (2)
Selection.Text = sCSZ
SelectIt (2)
Selection.Text = ""
SelectIt (2)
Selection.Text = ""
SelectIt (1)
Selection.Fields.Add Range:=Selection.Range, _
Type:=wdFieldEmpty, _
Text:="BARCODE \u """ & sCSZ & """", _
PreserveFormatting:=False
End Sub

This uses two functions or subroutines:

Private Sub SelectIt(iField As Integer)
' Routine goes to beginning of document and then goes to field
' iField sets number of field to go to
' Used in new document menus
'
Dim iNumber As Integer
Selection.HomeKey Unit:=wdStory
For iNumber = 1 To iField
Selection.NextField.Select
Next iNumber
End Sub

Function WorkGroupPath() As String
' Written by Charles Kenyon
' February 28, 2003
'
' Used by templates menus to set location of templates.
' Returns workgroup tempates path with "\" at the end.
'
' This is needed because if the folder is a network drive rather
' than a folder, it will have the "\" already. If it is a folder,
' it will not have the backslash. This function gives a string
' with the backslash in either case.
'
WorkGroupPath =
Application.Options.DefaultFilePath(wdWorkgroupTemplatesPath)
If Right(WorkGroupPath, 1) <> "\" Then
WorkGroupPath = WorkGroupPath & "\"
End If
End Function

Hope these help,
--
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://www.mvps.org/word 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.
 
C

Charles Kenyon

This solution will work where you always want an envelope. Unprotect the
template, create the envelope as an addition to the document, insert the
appropriate REF fields on the envelope, and reprotect it. The envelope will
show up (as section 0) on any documents created from the template.
--
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://www.mvps.org/word 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.
 
G

Guest

Charles-

Thanks. Exactly what I wanted to do, and it worked beautifully. One thing I
noticed, though: When I reopen the document (now with an envelope attached),
I see the envelope and the scroll bar on the side suggests that the envelope
is the entire document. In other words, there's apparently no room to scroll.
As soon as you click anywhere in the scroll bar, the rest of the document
appears. Strange.

Not a big deal, but a minor annoyance.

Thanks again.

-J.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top