I thought I could outsmart it by changing the document width, but the net allowable value of intent remained the same. I made the addressee text size smaller thinking that might change the block dimensions, but no luck. I learned that the maximum value the program will accept is 4.75. But the program responded with “One of the values passed to this method or property is out of range.
That being the case, I changed the value from 1.75 to 5.5. The result was that the addressee text block printed 1.75″ from the left edge of the 8.5″ wide paper. AddressFromLeft = wrdApp.InchesToPoints(1.75) StrAddress = olkCon.FullName & vbCrLf & olkCon.CompanyName & vbCrLf & olkCon.MailingAddressįunction IsBlank(strVal As String) As Boolean Just trying to give something back in return for all of the help and useful information I’ve gotten from other Internet citizens. Insert Address:=strAddress, ReturnAddress:=strReturnĬonst RETURN_ADDRESS = "David Lee/n123 Main St./nAnytown, USA 12345"ĭim olkCon As Object, wrdApp As Object, wrdDoc As Object, wrdEnv As Object, strAddress As String, strReturn As String, bolOmt As Boolean StrReturn = Replace(RETURN_ADDRESS, "/n", vbCrLf) If MsgBox("Are you using a preprinted envelope?", vbQuestion + vbYesNo, SCRIPT_NAME) = vbYes Then If you answer “Yes”, then it will suppress the return address.ĭim olkCon As Object, wrdApp As Object, wrdDoc As Object, strAddress As String, strReturn As String This version of the script prompts with the question “Are you using a preprinted envelope?” each time you run it. Follow these instructions to add the macro to the QAT. Follow these instructions to add toolbar buttons that runs the macro. If you want to be able to run the macro with a single click, then you’ll need to add a toolbar button for Outlook 2007 or a button on the Quick Access Toolbar (QAT) for Outlook 2010. Adding Buttons to Run the Macro with a Single Click. The envelope will print on your default printer. The contact can be in any contact folder.Ģ. Insert Address:=strAddress, ReturnAddress:=Replace(RETURN_ADDRESS, "/n", vbCrLf)ġ. Set wrdApp = CreateObject("Word.Application") StrAddress = olkCon.FullName & vbCrLf & olkCon.MailingAddress MsgBox "You must select a contact in order to use this macro.", vbCritical + vbOKOnly, SCRIPT_NAME Select Case TypeName(Application.ActiveWindow) Use /n to indicate the end of a line.Ĭonst RETURN_ADDRESS = "David Lee/n101 Main Street/nHometown, USA 10101"ĭim olkCon As Object, wrdApp As Object, wrdDoc As Object, strAddress As String 'On the next line edit your return address. Click the diskette icon on the toolbar to save the changes.