Microsoft KB Archive/109410

From BetaArchive Wiki



Using Arrays with Workgroup Extensions for Microsoft Excel

Last reviewed: October 7, 1997
Article ID: Q109410



4.00 WINDOWS kbusage The information in this article applies to:

  • Microsoft Excel for Windows, version 4.0

SUMMARY

The following macro demonstrates the steps necessary to use an array of recipient names 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 each person listed in the array A2:C4. The address should include the message type preceding the email name. Class types are 1=to:, 2=cc:, and 3=Bcc:.

NOTE: Before you run this macro, place the file XLMAPI.XLL in the XLSTART directory to load this file into memory.

Sample Macro Code

 A1  NAME                 B1  ADDRESS          C1 CLASS
 A2  John Smith           B2  ipm:johnsm       C2 1
 A3  Jane Doe             B3  ipm:janedo       C3 2
 A4  Fred Wong            B4  ipm:fredwo       C4 3
 A5  =MAIL.LOGON("MY LOGON NAME","MY PASSWORD",TRUE)
 A6  =MAIL.NEW.MESSAGE()
 A7  =SET.MAIL.MESSAGE(7,A2:C4)
 A8  =SET.MAIL.MESSAGE(1,"This is a Microsoft Excel MAPI test")
 A9  =MAIL.SEND.MESSAGE()
 A10 =MAIL.LOGOFF()
 A11 =RETURN()

Explanation of Macro

  A5:  Logs onto email for this instance of Microsoft Excel. This step is
      necessary even if you are currently logged into your mail host.

  A6:  Creates a new mail message.

  A7:  Sets Recipients to the recipient array.

  A8:  Sets Mail message title.

  A9:  Sends the current mail message.

 A10: Logs you off of mail currently used for this instance of Microsoft
      Excel. If you were logged into your mail host prior to running this
      macro, MAIL.LOGOFF() will not log you off of that previous instance
      of mail.

 A11: Ends the macro.

Creating the Above Macro

To create the above macro, follow the steps below:

  1. Type the above macro commands using the correct email name and password.
  2. Create your recipient array similar to A2:C4, using the correct email names (the correct message type "IPM,IPC,MTP" and so on, can be found by referring to the technical reference manual for your mail system).

    NOTE: This same array can be created by the array formula

          ={"John Smith","ipm:johnsm",1;"Jane Doe","ipm:janedo",2;"Fred
          Wong","ipm:fredwo",3}

    and referenced by the SET.MAIL.MESSAGE function.

Microsoft provides macro examples for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This macro is provided 'as is' and Microsoft does not guarantee that the following code can be used in all situations. Microsoft does not support modifications of the code to suit customer requirements for a particular purpose.

MORE INFORMATION

If you have a modem, you can get more information about Workgroup Extensions for Microsoft Excel or get a copy of the XLMAPI.XLL file by downloading the MAPIDEMO.EXE file from the Microsoft Download Service (MSDL). To connect to the MSDL, call (425) 936-MSDL.



KBCategory: kbusage

KBSubcategory:

Additional reference words: 4.00 4.00a howto email XLMAPI.XLL
Keywords : kbusage
Version : 4.00
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.