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

I don't see anything there that could cause the symptoms you described. (The
ActiveDocument.PrintOut statement should include the Background:=False
parameter to make the macro wait until spooling has finished before trying
to close the document, but that wouldn't change the behavior so
drastically.)

If you want me to look at the template and try to figure out what's wrong,
zip it and email it to me.

--
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.

MoJR wrote:
Jay,
This is the version of the code I developed.
Sub MakeEnvelope2()
Dim addr As String
addr = _
ActiveDocument.FormFields("name").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
ActiveDocument.PrintOut
ActiveDocument.Close
End Sub

Thank you,
mojr

"Jay Freedman" wrote:

On Thu, 23 Feb 2006 20:10:27 -0800, "MoJR"
wrote:

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


I don't know of any (ordinary) way to make a macro behave differently
depending on whether it's launched from a button or a keystroke. It
takes some fairly sophisticated VBA to do that...

First, make absolutely sure that you've assigned the keystroke to the
macro (look in Tools Customize Keyboard and click the macro's
name to see what keystroke is assigned to it).

If that's OK, post your version of the code for me to look at. If I
don't see anything likely, I'll ask you to send me a copy of the
template.

--
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.