Excel: Using Workgroup Extensions for Microsoft Excel

Last reviewed: October 7, 1997
Article ID: Q101363
4.00 4.00a WINDOWS kbmacro

The information in this article applies to:

  • Microsoft Excel for Windows, versions 4.0 and 4.0a

SUMMARY

The following macro demonstrates the steps necessary to send electronic mail from a Microsoft Excel macro using Workgroup Extensions for Microsoft Excel. The purpose of this macro is to send a mail message to a person with the email alias "JillDoe" and to attach the ARCHES.BMP file.

NOTE: Before you run the macro, you must load the file XLMAPI.XLL.

The macro is as follows

          A
   1  auto_email
   2  =MAIL.LOGON(,"CoolPass",FALSE)
   3  =MAIL.NEW.MESSAGE()
   4  =SET.MAIL.MESSAGE(7,"JillDoe"))
   5  =SET.MAIL.MESSAGE(1,"My Test Message")
   6  =SET.MAIL.MESSAGE(8,"c:\windows\arches.bmp")
   7  =SET.MAIL.RECIPIENT(GET.MAIL.MESSAGE(9)+1,"JoUser",,2)
   8  =MAIL.SEND.MESSAGE()
   9  =MAIL.LOGOFF()
   10 =RETURN()

where:
  • Line 2 of the macro connects to mail using the password CoolPass. Note here that you MUST use the MAIL.LOGON() command even if you are currently logged into mail. MAIL.LOGON() establishes a mail session for this instance of Microsoft Excel only.
  • Line 3 creates a new, blank mail message.
  • Lines 4-6 use the SET.MAIL.MESSAGE() command to fill in the header information for the mail message. In each line, the first argument specifies which part of the mail header you are modifying (7 is recipient; 1 is subject text; 8 is attachment path and filename).
  • Line 7 uses the GET.MAIL.RECIPIENT() command to add JoUser to the cc (carbon copy) line of the mail message. The GET.MAIL.MESSAGE() command is used to get the total number of recipients and adding 1 to it (which creates "room" for the person being added to the cc line).
  • Line 9 sends the email message.
  • Line 11 disconnects mail for this instance of Microsoft Excel.

MORE INFORMATION

For more information on Workgroup Extensions for Microsoft Excel, or to obtain the XLMAPI.XLL file, download the file MAPIDEMO.EXE from the Microsoft Download Service at (425) 936-MSDL.

REFERENCES

Workgroup Extensions for Microsoft Excel


KBCategory: kbmacro
KBSubcategory:

Additional reference words: 4.X 4.00 4.00a xl emailing electronic
WAKIT
Keywords : kbmacro
Version : 4.00 4.00a
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 7, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.