S
Southern at Heart
I am needing 2 macros to insert an envelope as either a business, or standard
letter size, but I can't get it to work. No matter what I specify in the
height and width, it seems the macro always gives me an envelope the size of
what ever I manually picked the last time I went under envelope options and
changed it. Am I doing something wrong here?
I have two macros, below is one of them I made witht the help of the
recorder. I should add a standard sized letter envelope, but if the last
envelope I manually added to a document was a business envelope, then that's
what will be added with this code. I can't figure this out!
Sub Standard_Envelope()
Dim strAddress As String
Dim object As MSForms.dataObject
Dim Name As Variant
Set object = New dataObject
object.GetFromClipboard
strAddress = object.GetText(1) 'Address copied from Clipboard
Name = Split(strAddress, vbCrLf) 'Copied from Outlook...
ActiveDocument.Envelope.Insert ExtractAddress:=False, OmitReturnAddress:= _
False, PrintBarCode:=False, PrintFIMA:=False,
Height:=InchesToPoints(3.63 _
), Width:=InchesToPoints(6.5), Address:=strAddress, AutoText:= _
"", ReturnAddress:="Me" & vbCrLf & "My street" & vbCrLf & _
"My City, state, zip", ReturnAutoText:= _
"", AddressFromLeft:=wdAutoPosition, AddressFromTop:= _
wdAutoPosition, ReturnAddressFromLeft:=wdAutoPosition, _
ReturnAddressFromTop:=wdAutoPosition, DefaultOrientation:= _
wdCenterLandscape, DefaultFaceUp:=True, PrintEPostage:=False
ChangeFileOpenDirectory _
"C:\Documents and Settings\Me\My Documents\My Office\Word
Items\My Letters\"
ActiveDocument.SaveAs FileName:=Name(0) & ".doc"
End Sub
letter size, but I can't get it to work. No matter what I specify in the
height and width, it seems the macro always gives me an envelope the size of
what ever I manually picked the last time I went under envelope options and
changed it. Am I doing something wrong here?
I have two macros, below is one of them I made witht the help of the
recorder. I should add a standard sized letter envelope, but if the last
envelope I manually added to a document was a business envelope, then that's
what will be added with this code. I can't figure this out!
Sub Standard_Envelope()
Dim strAddress As String
Dim object As MSForms.dataObject
Dim Name As Variant
Set object = New dataObject
object.GetFromClipboard
strAddress = object.GetText(1) 'Address copied from Clipboard
Name = Split(strAddress, vbCrLf) 'Copied from Outlook...
ActiveDocument.Envelope.Insert ExtractAddress:=False, OmitReturnAddress:= _
False, PrintBarCode:=False, PrintFIMA:=False,
Height:=InchesToPoints(3.63 _
), Width:=InchesToPoints(6.5), Address:=strAddress, AutoText:= _
"", ReturnAddress:="Me" & vbCrLf & "My street" & vbCrLf & _
"My City, state, zip", ReturnAutoText:= _
"", AddressFromLeft:=wdAutoPosition, AddressFromTop:= _
wdAutoPosition, ReturnAddressFromLeft:=wdAutoPosition, _
ReturnAddressFromTop:=wdAutoPosition, DefaultOrientation:= _
wdCenterLandscape, DefaultFaceUp:=True, PrintEPostage:=False
ChangeFileOpenDirectory _
"C:\Documents and Settings\Me\My Documents\My Office\Word
Items\My Letters\"
ActiveDocument.SaveAs FileName:=Name(0) & ".doc"
End Sub