View Single Post
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
MoJR
 
Posts: n/a
Default Can I print an envelope without unlocking my document? Slight

Jay,
The new macro works great. I managed to modify it to include printing my
documents that go with the envelope. However, when I assign it to a
keystroke, it opens the print dialogue. If I then hit 'print' the delivery
address disappears and the envelope does not print, but two copies of the
document will print. When I assign it to a toolbar and click it with the
mouse it works fine. It would be nice to use the keyboard.
Thank you in advance for your help.
mojr

"Jay Freedman" wrote:

MoJR wrote:
Hello,
This question is mainly for Jay Freedman, but anyone may answer. That
sounds a bit snobby. Sorry! Anyway, Jay you helped me create a macro
to unlock, print an enveope and re-lock a document. That worked well
because the address was in one block and could be highlighted as a
block. I have created a new document and I want to run the same
macro. However, the address is in two blocks and cannot be
highlighted as a single block without first unlocking the document.
This totally defeats the purpose of the document. It is an automated
document that uses the REF code to autopopulate the name in two
different pages of the document. To accomplish that I had to use one
textbox for the Name and one textbox for the Address. How do I
accomplish this? Thank you in advance!! mojr


Look in the Properties dialogs of the name and address form fields to find
out what their names are (the entry in the Bookmark box, which is the same
thing you use in the Ref fields to repeat the information). If they aren't
"Name" and "Address" then you'll have to change the names used in the
following updated macro:

Sub MakeEnvelope()
Dim addr As String
addr = _
ActiveDocument.FormFields("Name").Result & vbCr & _
ActiveDocument.FormFields("Address").Result

If ActiveDocument.ProtectionType wdNoProtection Then
ActiveDocument.Unprotect
End If


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


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

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.