• Envelope Dilemma, Part 2 (Word 97SR2)

    Author
    Topic
    #374406

    For the “envelope data” ( return address, recipient address and logo) to print,
    the user will click the Ok button on the form below.

    This is my attempt at replacing the built-in Word dialog as mentioned in Part 1.

    What code will get the envelope to print?

    If I use the .execute method on the dialog (as in:

    set dlg = dialogs(wdDialogToolsEnvelopesAndLabels)
    With dlg
    .EnvOmitReturn = false
    .execute
    End with

    Word inserts an envelope page into the document. I don’t want that. The user must
    then print the page to get the envelope printed then delete the envelope page.
    I want the the envelope to print when the user presses the Ok button on the form below. How can I program that?

    Viewing 1 reply thread
    Author
    Replies
    • #605536

      Kevin,

      It looks like you can do this:

      Dim doc As Document
      
      Set doc = ActiveDocument
      
      set dlg = dialogs(wdDialogToolsEnvelopesAndLabels)
      With dlg
          .EnvOmitReturn = false
      End with
      
      doc.Envelope.PrintOut
      

      If that doesn’t work, you could try:

      Leaving the .Execute in and adding the following line after the .execute

      doc.PrintOut , , wdPrintFromTo, , 1, 1

      • #605686

        Bryan, Thanks for your reply. The problem with this solution is the envelope page still gets added to the document. I suppose if I could allow the page to insert, print it then delete it, then this would work for me.

      • #605691

        …which leads me to the next obvious question: What’s the easiest way to remove an envelope from a document?

        • #605693

          Kevin,

          Given all the work you are having to do, why not just create a new document, with .Visible=False, use Page Setup to set it to match your envelopes, put the text boxes where you want, print it and delete it again?

          StuartR

          • #605698

            Believe me, do. (A little Beatlesesque lingo there for you.) I thought of this and have not completely axed the idea. The delete part would certainly be easy.

        • #605696

          I only have W2K here, but when the envelope get inserted into the document for me, it is at the beginning of the document, so…

          ActiveDocument.Sections(1).Range.Delete

          Will get rid of the first section, which is the envelope.

          • #605697

            It’s a good thing you can think on a Friday. I can’t. Nicely done.

            • #605700

              It’s a gift smile.

              No wait a minute, it’s ’cause I’m bored outta my skull and needed something to do.

              It’s Friday afternoon, before a 3 day weekend, followed by almost 2 weeks off, and nothing to do (Just don’t tell my boss that exclamation )

            • #605702

              bubbles Bored, huh? Well, don’t spend all your time off here. That’ll really drive you nuts

            • #605703

              nuts, me??

              Too late exclamation bananas exclamation bananas exclamation bananas exclamation bananas

            • #605704

              Back on topic for a minute:

              What do you know about the autotext entries EnvelopeExtra1 and 2? I’m using one of these (the 1) for the logo. If Word finds these autotext pieces, it’ll use them in the return address. I’m wondering if I can use the Extra2 to slap the nicely formatted return address up there next to the logo. Then, the envelope should print without having to insert it into the doc. That would be nice.

            • #605707

              No. I have no idea about the autotext entries.

              I didn’t even know they existed.

            • #605708

              Well, there’s something you can do to keep the boredom at bay… dizzy

            • #605719

              Here is your answer.

              Yes you can.

              The only problem is it looks like they are inserted one below the other.

              I did play around with it a bit and it looks like, you may have to play with the positioning and the layout/wrapping of the logo for it to appear on the envelope properly.

              Or at least in W2K you can.

              But the question becomes, why don’t you just add the logo and the nicely formatted text to the EnvelopeExtra1 AutoText entry?

            • #605723

              >>But the question becomes, why don’t you just add the logo and the nicely formatted text to the EnvelopeExtra1 AutoText entry?

              Could the answer be: “Because the logo never changes but the return address could be different for each envelope?

              I’m onto it though. Testing as we speak…

            • #605729

              Good luck

              I’m off to Watkins Glen State Park for the weekend now. YEA!!!! joy

            • #605730

              Ok, thanks for your help. It’s working great with EnvelopeExtra2, so it looks like a keeper.

            • #605959

              I think that gets me off the hook on the question you asked me. I think that has come up before, that certain of the dialog controls are rich text controls, but that there doesn’t seem to be any programmatic way to access the formatting. Perhaps the AutoText entry is the secret (previously hidden) link. Bravo on the sleuthing.

              (As for your question about whether I have documentation, maybe

    • #605583

      Add this parameter:

      .PrintEnvLabel = True

      • #605684

        That indeed works. And thank you Jefferson. Now, I see that parameter in the “Built-in Dialog Box Argument List” in the help. But how did you know what it does? In other words, do you have some documentation on these arguments?

      • #605690

        The only remaining problem is this: I need to format the return address with all lines bold and centered to right of the logo.

        By inserting the envelope into the document, I can put a text box next to the logo and format the return address.

        But the Return Address field in the Word Envelopes and Labels dialog (which is what the .PrintEnvLabel uses to print the envelope) does not appear to allow any formatting.

        Do you know if there Is there a way to format that field?

      • #608316

        Jefferson,

        How about this argument:?

        .EnvPaperName

        The envelope prints to the “manual” bin. I need to set it either to Automatically Select or Envelope Feeder.

        Not sure that’s the correct argument; nor do I know the syntax to use it properly. Any discoveries?

        • #608587

          Does your syntax from Post #42652 not work? It persisted into the revised version (Post #57945)…

          • #608754

            Unfortunately it does not. Sure sounded good though, huh?

          • #608760

            Hummm. Wait, maybe that second one *does* work. I’m testing existing Word 97 code on Word 2002 and running into problems.

            I need to try .EnvPaperName again.

            Thanks for showing me my own stuff. Gee wiz.

    Viewing 1 reply thread
    Reply To: Envelope Dilemma, Part 2 (Word 97SR2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: