Outlook.MobileItem in MS Outlook 2010 to Create SMS and MMS Messages in VB.NET

In this article I am going to explain about how to create Short Message Service (SMS) text messages or multimedia message (MMS) messages from within Microsoft Outlook 2010.
  • 2845

Introduction

In this article I am going to explain about how to create Short Message Service (SMS) text messages or multimedia message (MMS) messages from within Microsoft Outlook 2010. For this we use Outlook.MobileItem in Microsoft Outlook 2010.

Microsoft Office 2010 offer some powerful tools, using this tools you can create application. Using Microsoft Visual Basic for Applications (VBA) you can create your own application according to your need. These application can performer some specific task.

For creating application we can use

  • VBA host of Excel 2010
  • VBA host of PowerPoint 2010
  • VBA host of Word 2010

NOTE : OneNote 2010 is not a VBA host.

Code that we use in this application are given below

Sub DemoMobileItem()
    Dim a As Outlook.Application
    a = ThisOutlookSession

    ' Here we set the path for image.

    Const pp As String = _
    
"D:\vipendra\dog.jpg"

    ' Here we are creating a SMS massage and provide text in body and in subject.

    Dim b As Outlook.MobileItem
    b = a.CreateItem(olMobileItemSMS)
    b.Subject = 
"Test SMS"
    b.Body = "Hello, This is vipendra. This is test SMS."
    b.Display(False)

    ' Here we are creating a MMS

    Dim m As Outlook.MobileItem
    m = a.CreateItem(olMobileItemMMS)
    m.Subject = 
"Hello, This is vipendra. This is test MMS."

    ' Here we attach the picture to the MMS.

    m.Attachments.Add(pp)
    m.Display(False)
End Sub

Step for creating Application

Step 1 : Start MS Outlook 2010 :

1 (1).jpg
 

Step 2 : Using Alt + F11 Key Start Visual Basic for Applications (VBA) Window :

2.jpg
 

Step 3 : Select on Project 1 :

3.jpg
 

Step 4 : Double Click on project 1 ==> Select Microsoft Outlook objects ==> Double click on Microsoft Outlook objects ==> Select on ThisOutlookSession==> Right Click on ThisOutlookSession and select View Code :

4.jpg

5.jpg
 

Step 5 : Write Code in Visual Basic for Applications (VBA) Window :

Clipboard06.jpg
 

Step 6 : Run Application using F5 :

Step 7 : Macros window will open, Select Macros name and click on Run Button :

Clipboard08.jpg
 

Step 8 : Output of Application :

Clipboard09.jpg
 

Clipboard10.jpg

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.