Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro: making multiples envelopes with different addresses

Status
Not open for further replies.

breanainneire

Technical User
Dec 12, 2007
2
CA
Hi. While printing off envelopes for Christmas cards, I thought that it might be easier to use a macro since I had to change formatting, fonts, etc. each time I made and envelope. I tried making a macro on my own, but I can't figure out how to program it so that the address I highlight in a Word document becomes the address that will eventually print on the envelope. (In other words, I would highlight a set of address text while recording the macro, but that would be the only address that would print if I tried to use the macro.) I've done some research on the internet, and I think I have to make a variable or something like a String, but everything I do doesn't work.


Here's a copy of my macro thus far where the address is just left blank.





Sub Macro1()
'
' Macro1 Macro
' Macro recorded 12/12/2007 by Ed Baartman
'
With ActiveDocument.Styles(wdStyleEnvelopeAddress).Font
.Name = "High Tower Text"
.Size = 12
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Spacing = 0
.Scaling = 100
.Position = 0
.Kerning = 0
.Animation = wdAnimationNone
End With
With ActiveDocument.Styles(wdStyleEnvelopeReturn).Font
.Name = "High Tower Text"
.Size = 10
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Spacing = 0
.Scaling = 100
.Position = 0
.Kerning = 0
.Animation = wdAnimationNone
End With
ActiveDocument.Envelope.PrintOut ExtractAddress:=False, OmitReturnAddress _
:=False, PrintBarCode:=False, PrintFIMA:=False, Height:=InchesToPoints( _
4.92), Width:=InchesToPoints(6.93), Address:="", AutoText:= _
"ToolsCreateLabels1", ReturnAddress:="Partners in Planning", _
ReturnAutoText:="ToolsCreateLabels2", AddressFromLeft:=wdAutoPosition, _
AddressFromTop:=wdAutoPosition, ReturnAddressFromLeft:=wdAutoPosition, _
ReturnAddressFromTop:=wdAutoPosition, DefaultOrientation:= _
wdCenterLandscape, DefaultFaceUp:=True
End Sub
 



Hi,

Why go to all that trouble, when MailMerge does EXACTLY what you need to do?

Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
No, mail merge is not what I want to use. See, all the addresses I need to send to are located in individual word documents of prior letters. All I want to do is go into each document, highlight the address, and run the macro so that each address is correctly printed just as I want, without me having to repeat the same formatting of fonts, etc. each time.
 



"...without me having to repeat the same formatting of fonts, etc. each time..."

What?

With MailMerge, you FORMAT your document ONE TIME and then run the merge.

EVERYTHING is so formatted.

Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
Why don't you copy you addresses to an Outlook contact or Acess table then you can do a mail merge. Then you can run emvelops or labels any time you like without having to open all those documents.

Simi
 
This seems to require more work than is needed. If I undertsand correctly, you are opening multiple documents, going to a chunk of text, selecting it, and...what? Copy it to some other document you are going to use for the address labels?

1. Using MailMerge does indeed sounds like a good idea. Unless this is a one-off thing. If it is NOT a one-off thing, then having the addresses in a MailMerge would simplify things immensely. You could use it repeatedly. You would have all the address in one place instead of multiple documents.

2. Using Styles may be a good option.

faq219-2884

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top