HOWTO: Performing OLE Automation with Visual Basic ScriptLast reviewed: September 30, 1997Article ID: Q165673 |
The information in this article applies to:
SUMMARYVisual Basic Scripting Edition (VBScript), version 1.0, does not support the CreateObject function that is available in Visual Basic for Applications (VBA). The HTML object tag can be used in conjunction with Visual Basic Scripting to automate any OLE Automation server. Note: VBScript 2.0 (and higher) now supports the CreateObject function. However, this version does not ship with the current version of Internet Explorer 3.0. Refer to http://www.microsoft.com/vbscript for more information on obtaining the latest version of VBScript 2.0.
MORE INFORMATIONWARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this 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. The following example demonstrates how the HTML object tag and Visual Basic Scripting can be used to send a message with the OLE Messaging Automation Object. NOTE: Replace objOneRecip.Name = "Some Name" with a valid recipient name:
<HTML> <HEAD> <TITLE>Sample Script to Send a MessagePage</TITLE> </HEAD> <BODY> <OBJECT ID="MAPI" WIDTH=10 HEIGHT=10 CLASSID="CLSID:3FA7DEB3-6438-101B-ACC1-00AA00423326"> </OBJECT> <SCRIPT LANGUAGE="VBScript"> Dim oSession, objMessage, objOneRecip MAPI.Logon Set objMessage = MAPI.Outbox.Messages.Add Set objOneRecip = objMessage.Recipients.Add objOneRecip.Name = "Some Name" objOneRecip.Type = 1 objOneRecip.Resolve 1 objMessage.subject = "Test MAPI/OLE VB Message w/ole object - explicit" objMessage.Text = "Like you really wanted this.. Please Delete this test" objMessage.Send 0,0,0 </SCRIPT> </BODY> </HTML> Keywords : OleMsg ActMsg kbinterop Technology : kbole Version : 1.0 Platform : WINDOWS Issue type : kbhowto Solution Type : kbcode |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |