Microsoft KB Archive/101363: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 16: Line 16:
== SUMMARY ==
== 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.
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.
NOTE: Before you run the macro, you must load the file XLMAPI.XLL.
Line 24: Line 24:
<pre>          A
<pre>          A
   1  auto_email
   1  auto_email
   2  =MAIL.LOGON(,&quot;CoolPass&quot;,FALSE)
   2  =MAIL.LOGON(,"CoolPass",FALSE)
   3  =MAIL.NEW.MESSAGE()
   3  =MAIL.NEW.MESSAGE()
   4  =SET.MAIL.MESSAGE(7,&quot;JillDoe&quot;))
   4  =SET.MAIL.MESSAGE(7,"JillDoe"))
   5  =SET.MAIL.MESSAGE(1,&quot;My Test Message&quot;)
   5  =SET.MAIL.MESSAGE(1,"My Test Message")
   6  =SET.MAIL.MESSAGE(8,&quot;c:\windows\arches.bmp&quot;)
   6  =SET.MAIL.MESSAGE(8,"c:\windows\arches.bmp")
   7  =SET.MAIL.RECIPIENT(GET.MAIL.MESSAGE(9)+1,&quot;JoUser&quot;,,2)
   7  =SET.MAIL.RECIPIENT(GET.MAIL.MESSAGE(9)+1,"JoUser",,2)
   8  =MAIL.SEND.MESSAGE()
   8  =MAIL.SEND.MESSAGE()
   9  =MAIL.LOGOFF()
   9  =MAIL.LOGOFF()
Line 38: Line 38:
* Line 3 creates a new, blank mail message.
* 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).
* 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 &quot;room&quot; for the person being added to the cc line).
* 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 9 sends the email message.
* Line 11 disconnects mail for this instance of Microsoft Excel.
* Line 11 disconnects mail for this instance of Microsoft Excel.

Latest revision as of 08:19, 20 July 2020


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


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