breanainneire
Technical User
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
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