Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
MoJR
 
Posts: n/a
Default Can I print an envelope without unlocking my document?

Jay,
Please refer to this macro you gave me:

First, understand that _all_ code must be between a line that starts

with "Sub" and a line that says "End Sub". If you try to stick some
code before the first Sub line, you'll just get a syntax error.

Second, you've now achieved a mishmash of bits and pieces that
wouldn't work together even if you got them in the right places.

The sequence of events you want, if I understand correctly what's in
the templates "MoJR Packet.dot" and "packet envelope.dot", is this:

1. Create a new document based on "MoJR Packet.dot" -- _not_ through a
macro, but by clicking File New and choosing that template. This new
document is a protected form that includes the fields pnm1 and padd1
through padd3. You manually enter name and address information in
these fields. If you want to keep a copy of the letter, you manually
save the document and give it a file name.

2. Press a key combination or click a toolbar button to run the
MakeEnvelope macro, which is stored in a module in the "MoJR
Packet.dot" template.

3. The macro mimics using the Envelope dialog and clicking the Add to
Document button to insert an envelope as page 0. Then it prints the
entire document, including the envelope and multiple copies of several
pages. The document should then be closed without being saved, so the
stored file doesn't include the envelope.

4. The macro creates a new document based on "packet envelope.dot"
which is a return envelope, prints it, and closes it without saving.

The macro that does steps 3 and 4 should look like this:

Sub MakeEnvelope()
Dim addr As String
addr = _
ActiveDocument.FormFields("pnm1").Result & vbCr & _
ActiveDocument.FormFields("padd1").Result
ActiveDocument.FormFields("padd2").Result
ActiveDocument.FormFields("padd3").Result

If ActiveDocument.ProtectionType wdNoProtection Then
ActiveDocument.Unprotect
End If

With Dialogs(wdDialogToolsEnvelopesAndLabels)
.DefaultTab = _
wdDialogToolsEnvelopesAndLabelsTabEnvelopes
.EnvReturn = Application.UserAddress
.AddrText = addr
.Execute
End With


ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True

With Dialogs(wdDialogFilePrint)
.Background = False
.Range = wdPrintRangeOfPages
.Pages = "0,1,2,2,3,3,3,4,4,4,5"
.Execute
End With

ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

Documents.Add Template:= _
"C:\Documents and Settings\MoJR\Application Data" _
& "\Microsoft\Templates\JR\packet envelope.dot", _
NewTemplate:=False, DocumentType:=0

ActiveDocument.PrintOut Background:=False

ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
End Sub

I am having trouble with this line; ActiveDocument.FormFields("padd2").Result
I get a compile error, incorrect use of property.
Please check this out and get back to me.
Thank you
mojr


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
Can I print an envelope without unlocking my document? Slight retu MoJR Microsoft Word Help 28 March 10th 06 05:30 AM
MS Word should let me print an envelope from MS Outlook in fewer . Kerk Farrell Microsoft Word Help 2 July 28th 05 05:42 AM
Print What... Document Showing Markup L Lightner Microsoft Word Help 2 May 6th 05 04:41 AM
during print preview legal size document cuts to letter size Jim Microsoft Word Help 0 April 19th 05 11:00 PM
Section of a Word Document Fails to Print and Drops Out of Attachm Manannan Microsoft Word Help 0 March 13th 05 02:31 PM


All times are GMT +1. The time now is 10:31 AM.

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"