P
Parag
I keep getting "Make sure that the maximum index on a list is less
than the list size" on the line "olItem.Subject = vInfo(1)" - any
clues on what the issue maybe?
This is a very simple app that's supposed to invoke a new Outlook
email message, break the command line output using "|" delimiter and
feed it into the To, Subject and Body fields of the email
respectively.
Module SendEmail
Public Sub Main()
Dim myOleApp As Microsoft.Office.Interop.Outlook.Application
Dim olItem As Microsoft.Office.Interop.Outlook.MailItem
Dim vInfo As Array
' Assume Command line parameter is text separated by "|"
vInfo = Split(Command, "|")
' Create Outlook instance and a mail item
myOleApp = New Microsoft.Office.Interop.Outlook.Application
olItem =
myOleApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
' Fill in To, Subject and Message
olItem.To = vInfo(0)
olItem.Subject = vInfo(1)
olItem.Body = vInfo(2)
'Actually send the email
olItem.Send()
' Tidy up
olItem = Nothing
myOleApp = Nothing
End Sub
End Module
than the list size" on the line "olItem.Subject = vInfo(1)" - any
clues on what the issue maybe?
This is a very simple app that's supposed to invoke a new Outlook
email message, break the command line output using "|" delimiter and
feed it into the To, Subject and Body fields of the email
respectively.
Module SendEmail
Public Sub Main()
Dim myOleApp As Microsoft.Office.Interop.Outlook.Application
Dim olItem As Microsoft.Office.Interop.Outlook.MailItem
Dim vInfo As Array
' Assume Command line parameter is text separated by "|"
vInfo = Split(Command, "|")
' Create Outlook instance and a mail item
myOleApp = New Microsoft.Office.Interop.Outlook.Application
olItem =
myOleApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
' Fill in To, Subject and Message
olItem.To = vInfo(0)
olItem.Subject = vInfo(1)
olItem.Body = vInfo(2)
'Actually send the email
olItem.Send()
' Tidy up
olItem = Nothing
myOleApp = Nothing
End Sub
End Module