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? Slight retu

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
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Cindy M -WordMVP-
 
Posts: n/a
Default Can I print an envelope without unlocking my document? Slight retu

Hi ?B?TW9KUg==?=,

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?

It might help if you copy the code Jay gave you into a message in this thread.
That way, we'd all (including Jay) have a starting point...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

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

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.


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



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

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.


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

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.

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



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
How do I get a No. 6 3/4 envelope to print correctly? HarrietYee Mailmerge 3 May 12th 23 02:52 PM
print preview and actual print is different from original document inenewbl Page Layout 1 February 16th 06 01:49 PM
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
One document - Two Printers (envelope and laser) John Foy Microsoft Word Help 0 March 9th 05 07:03 PM


All times are GMT +1. The time now is 09:35 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"