WD: Macros to Send a Word Document as Text or an Attachment

ID: Q96982

The information in this article applies to:

SUMMARY

The WordBasic FileSendMail statement opens a message window for sending the active document through a Microsoft Messaging Application Programming Interface (MAPI) - compliant mail system, such as Microsoft Mail or Microsoft Exchange. The current document is either inserted as text or inserted as an embedded attachment to the mail message.

MORE INFORMATION

To change this setting programmatically, use the example appropriate for your version of Word.

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.

Word for Windows 6.x, 7.x

You can use the ToolsOptionsGeneral statement with the .SendMailAttach parameter to control whether the document is sent as text in the message window or as an attachment.

The following sample macro sends the current document as an attachment to a mail message:

   Sub MAIN
      ToolsOptionsGeneral .SendMailAttach = 1
      FileSendMail
   End Sub

The following sample macro inserts the current document text into a mail message:

   Sub MAIN
      ToolsOptionsGeneral .SendMailAttach = 0
      FileSendMail
   End Sub

Word for Windows 2.x

The WordBasic FileSend statement is available in Word for Windows versions 2.0b and 2.0c. The .SendMailAttach argument was added to the ToolsOptionsGeneral command in Microsoft Word version 2.0c for Windows.

To obtain pre-sales information about new or updated Microsoft products, call the Microsoft Sales Information Center at (800) 426-9400. If you are outside the United States, contact the Microsoft subsidiary for your area. To locate your subsidiary, see the Microsoft World Wide Offices Web site at:

   http://www.microsoft.com/worldwide/default.htm

REFERENCES

"Using WordBasic" by WexTech Systems and Microsoft

Kbcategory: kbusage kbmacro KBSubcategory: Additional query words: winword2 2.0b 2.0c attachment winword 7.0 word95 word7 word6 icon embed mail sendmailattach file send macword 6.0.1 filesendmail Version : 2.x 6.0 6.0a 6.0c 7.0 7.0a

Last Reviewed: July 30, 1997