WD: UseEnvFeeder Argument of ToolsCreateEnvelope Fails

ID: Q168412

The information in this article applies to:

SYMPTOMS

When you use the WordBasic ToolsCreateEnvelope statement to create an envelope, the UseEnvFeeder argument fails to change the tray for feeding envelopes. Using a setting greater than 1 causes the following error when you attempt to run the macro:

   WordBasic Err=159: The value of one of the fields is too high.

CAUSE

Although UseEnvFeeder is a valid argument of the ToolsCreateEnvelope statement, it does not function correctly.

WORKAROUND

To work around this problem use one of the following methods.

Method 1: Manually Set the Envelope Feed From Setting

Use the following steps to manually set the Envelope Feed From tray from the Create Envelope dialog box:

1. On the Tools menu, click Envelopes And Labels.

2. On the Envelopes dialog box, click Options.

3. In the Feed From list box, select the desired feed method.

4. Click OK.

5. Click Cancel.

When you run the macro, the envelope will use the setting you selected in step 3.

Method 2: Use the SendKeys Statement to Set the Feed From Selection

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

If you need to switch between envelope feed trays you can use SendKey commands as shown in the following example WordBasic macro.

   Sub MAIN
      FeedType$ = "e" ' The letter "e" will select
                      ' Envelope Feeder. To specify
                      ' any other method, use the first
                      ' letter of the feed type.
      SendKeys "%te%o%f" + FeedType$ + "{Enter}{Enter}%p"
      ' %te       - Opens the Envelopes And Labels dialog box.
      ' %o        - Selects the Options button.
      ' %f        - Selects the Feed From drop-down list.
      ' FeedType$ - Selects one of the options in the Form Feed list box.
      ' {Enter}   - Sets the choice from the drop-down list.
      ' {Enter}   - Closes the Envelope Options dialog box.
      ' %p        - Prints the envelope.
   End Sub

This macro will simulate the keystrokes required to change the envelope printing options and will print the envelope.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The WordBasic Help file states the following:

.  UseEnvFeeder   A number corresponding to the envelope source listed in
                  the Feed From box: 0 (zero) corresponds to the first
                  source, 1 to the second source, and so on.

This feature does not work correctly. When printing envelopes using the ToolsCreateEnvelope command, Word defaults to using the last tray selected in the Create Envelopes dialog box, regardless of the setting used for the UseEnvFeeder property.

Additional query words: manual automatic feeding incorrect wrong

Keywords          : kbmacro kbdtacode winword word6 word7 word95 
Version           : 6.0 6.0a 6.0c 7.0 7.0a
Platform          : WINDOWS
Issue type        : kbbug

Last Reviewed: March 27, 1998