plumnoob.blogg.se

How to create and print an envelope in word 2013
How to create and print an envelope in word 2013













how to create and print an envelope in word 2013

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.

how to create and print an envelope in word 2013

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.

How to create and print an envelope in word 2013 code#

  • Edit the return address at the top of the code just below the comment.
  • Copy the code from the code snippet box and paste it into the right-hand pane of Outlook’s VB Editor window.
  • Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert → Module.
  • If not already expanded, expand Modules.
  • If not already expanded, expand Microsoft Office Outlook Objects.
  • Press ALT + F11 to open the Visual Basic Editor.
  • Instructions.įollow these instructions to add the code to Outlook. It may work in earlier versions too, but I haven’t tested with anything older than 2007. This solution should work in Outlook/Word 2007 and later. Hopefully this script will make Chuck’s work a little simpler, faster, and more efficient. Otherwise, it gets the default address of the selected contact, launches Word, creates an envelope, adds the contact’s address, adds your return address (which you define in the script), and prints the envelope. If it isn’t, then the script displays an error and exits. Next, it checks to see if that item is a contact. The script starts by checking to see if you have an item open or just have one selected. That’s largely due to how easy Microsoft has made it to print an envelope from Word. Time to do some scripting.Īt 27 lines of code, the resulting script is surprisingly short. Although I rarely use postal mail myself, I can see how this could be useful for those who do. Copying the address is simpler than setting up a mail merge, but it’s still too time consuming. Chuck noted that the only two ways he knows of to do this now is to either do a mail merge, which isn’t practical for printing a single envelope, or to copy and paste the contact’s address into Word. One of the items on his list is the ability to print an envelope from a contact. Recently, I was talking with my friend Chuck about features he wishes Microsoft would add to Outlook.















    How to create and print an envelope in word 2013