PC Review


Reply
Thread Tools Rate Thread

Can I print an envelope without unlocking my document? Slight retu

 
 
=?Utf-8?B?TW9KUg==?=
Guest
Posts: n/a
 
      22nd Feb 2006
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
 
Reply With Quote
 
 
 
 
Cindy M -WordMVP-
Guest
Posts: n/a
 
      23rd Feb 2006
Hi =?Utf-8?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 :-)

 
Reply With Quote
 
Jay Freedman
Guest
Posts: n/a
 
      23rd Feb 2006
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.


 
Reply With Quote
 
=?Utf-8?B?TW9KUg==?=
Guest
Posts: n/a
 
      24th Feb 2006
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.
>
>
>

 
Reply With Quote
 
Jay Freedman
Guest
Posts: n/a
 
      24th Feb 2006
On Thu, 23 Feb 2006 20:10:27 -0800, "MoJR"
<(E-Mail Removed)> 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 With Quote
 
=?Utf-8?B?TW9KUg==?=
Guest
Posts: n/a
 
      24th Feb 2006
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"
> <(E-Mail Removed)> 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 With Quote
 
Jay Freedman
Guest
Posts: n/a
 
      24th Feb 2006
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"
>> <(E-Mail Removed)> 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 With Quote
 
=?Utf-8?B?TW9KUg==?=
Guest
Posts: n/a
 
      24th Feb 2006
Jay,
I guess I didn't put the Backgounf:=False statement in the right place.
Do I need to paste this code into an existing template for it to work as
expected? Currently, it is on a tool bar and not in any existing template.
mojr

"Jay Freedman" wrote:

> 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"
> >> <(E-Mail Removed)> 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 With Quote
 
Jay Freedman
Guest
Posts: n/a
 
      24th Feb 2006
Whoa, back up the truck... The macro and the toolbar must be stored in some
file, whether a document (.doc) or a template (.dot) file. What is that
file?

MoJR wrote:
> Jay,
> I guess I didn't put the Backgounf:=False statement in the right
> place. Do I need to paste this code into an existing template for it
> to work as expected? Currently, it is on a tool bar and not in any
> existing template. mojr
>
> "Jay Freedman" wrote:
>
>> 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"
>>>> <(E-Mail Removed)> 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 With Quote
 
=?Utf-8?B?TW9KUg==?=
Guest
Posts: n/a
 
      25th Feb 2006
Jay,
As far as I know, the macro and toolbar are stored in the normal.dot template.
mojr

"Jay Freedman" wrote:

> Whoa, back up the truck... The macro and the toolbar must be stored in some
> file, whether a document (.doc) or a template (.dot) file. What is that
> file?
>
> MoJR wrote:
> > Jay,
> > I guess I didn't put the Backgounf:=False statement in the right
> > place. Do I need to paste this code into an existing template for it
> > to work as expected? Currently, it is on a tool bar and not in any
> > existing template. mojr
> >
> > "Jay Freedman" wrote:
> >
> >> 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"
> >>>> <(E-Mail Removed)> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to print only an envelope that was added to document in Word 2 CinBar Microsoft Word Document Management 4 28th Jun 2008 05:38 AM
Re: Can I print an envelope without unlocking my document? =?Utf-8?B?TW9KUg==?= Microsoft Word Document Management 0 23rd Mar 2006 08:49 PM
how do i rotate a document or print small document on envelope =?Utf-8?B?Y3J5c3RhbA==?= Microsoft Excel New Users 2 23rd Mar 2006 03:52 PM
Can I print an envelope without unlocking my document? =?Utf-8?B?TW9KUg==?= Microsoft Word Document Management 0 14th Mar 2006 10:26 PM
"Re: Can I print an envelope without unlocking my document? Slight =?Utf-8?B?TW9KUg==?= Microsoft Word Document Management 0 5th Mar 2006 11:32 PM


Features
 

Advertising
 

Newsgroups
 


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