Reply
 
Thread Tools Display Modes
  #1   Report Post  
Tpeila
 
Posts: n/a
Default Creating envelopes in a protected document

I have a protected document that has form fields. Once the form is filled out
I want to be able to create an envelope from an address residing in one of
the form fields. I was going to manually record a macro to select the
address, unlock the document, and then print and envelope. However I cannot
figure out how to start a macro in the locked document environment? Any
suggestions on how to do this or another way of going about it?

Thanks, Tanya
  #2   Report Post  
Charles Kenyon
 
Posts: n/a
Default

The following are macros used for me to make an envelope from my billing
form.

Sub KenyonBillEnvelope()
'
' Envelope 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

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(wdWorkgroupTem platesPath)
If Right(WorkGroupPath, 1) "\" Then
WorkGroupPath = WorkGroupPath & "\"
End If
End Function

These use an envelope template that has macrobutton fields to insert things
in the address (used for manual typing of an envelope). The key feature is
the statements that get information from particular form fields and put that
information into variables. The variable information is then placed into the
macrobutton fields (replacing the fields). You could use bookmarks in your
envelope template instead.

Hope this helps get you started.
--
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.

"Tpeila" wrote in message
...
I have a protected document that has form fields. Once the form is filled
out
I want to be able to create an envelope from an address residing in one of
the form fields. I was going to manually record a macro to select the
address, unlock the document, and then print and envelope. However I
cannot
figure out how to start a macro in the locked document environment? Any
suggestions on how to do this or another way of going about it?

Thanks, Tanya



  #3   Report Post  
Tpeila
 
Posts: n/a
Default

Hoyl cow I don't know where to start. Thank you!

Tanya

"Charles Kenyon" wrote:

The following are macros used for me to make an envelope from my billing
form.

Sub KenyonBillEnvelope()
'
' Envelope 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

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(wdWorkgroupTem platesPath)
If Right(WorkGroupPath, 1) "\" Then
WorkGroupPath = WorkGroupPath & "\"
End If
End Function

These use an envelope template that has macrobutton fields to insert things
in the address (used for manual typing of an envelope). The key feature is
the statements that get information from particular form fields and put that
information into variables. The variable information is then placed into the
macrobutton fields (replacing the fields). You could use bookmarks in your
envelope template instead.

Hope this helps get you started.
--
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.

"Tpeila" wrote in message
...
I have a protected document that has form fields. Once the form is filled
out
I want to be able to create an envelope from an address residing in one of
the form fields. I was going to manually record a macro to select the
address, unlock the document, and then print and envelope. However I
cannot
figure out how to start a macro in the locked document environment? Any
suggestions on how to do this or another way of going about it?

Thanks, Tanya




  #4   Report Post  
Suzanne S. Barnhill
 
Posts: n/a
Default

If that's literally true, see http://www.gmayor.com/installing_macro.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Tpeila" wrote in message
...
Hoyl cow I don't know where to start. Thank you!

Tanya

"Charles Kenyon" wrote:

The following are macros used for me to make an envelope from my billing
form.

Sub KenyonBillEnvelope()
'
' Envelope 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

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(wdWorkgroupTem platesPath)
If Right(WorkGroupPath, 1) "\" Then
WorkGroupPath = WorkGroupPath & "\"
End If
End Function

These use an envelope template that has macrobutton fields to insert

things
in the address (used for manual typing of an envelope). The key feature

is
the statements that get information from particular form fields and put

that
information into variables. The variable information is then placed into

the
macrobutton fields (replacing the fields). You could use bookmarks in

your
envelope template instead.

Hope this helps get you started.
--
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.

"Tpeila" wrote in message
...
I have a protected document that has form fields. Once the form is

filled
out
I want to be able to create an envelope from an address residing in

one of
the form fields. I was going to manually record a macro to select the
address, unlock the document, and then print and envelope. However I
cannot
figure out how to start a macro in the locked document environment?

Any
suggestions on how to do this or another way of going about it?

Thanks, Tanya





Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Making Spell Check Work on a protected document Jacob_F_Roecker Microsoft Word Help 3 June 8th 05 08:59 PM
Protected Document? Cindy New Users 2 May 10th 05 11:55 PM
Option buttons don't work when word document is protected Valerie Tables 1 May 9th 05 06:41 PM
unprotect a protected document Twiggy Microsoft Word Help 1 May 8th 05 07:51 PM
How do I copy certain text from a protected document? Melissa Microsoft Word Help 1 January 19th 05 04:24 PM


All times are GMT +1. The time now is 03:51 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"