Linked Questions

Popular Questions

Using Outlook 365 with VB6

Asked by At

We have switched over to office 365 / outlook. we have a legacy application in VB6 the was working fine with the previous version of outlook. but now we are having issues with an automated email with in VB6, that sends daily reports. Can someone tell me what is the equivalent of the following code is and what reference i need to point to?`

            Dim mstrEmailTo         As String                      'email to addresses
            Dim mstrEmailCC         As String                      'email cc addresses
            mstrEmailTo = Text1.Text
            mstrEmailCC = "TestEmail"

            Dim oApp As Outlook.Application
            Dim oCB As Office.CommandBar
            Dim oCBTools As Office.CommandBarPopup
            Dim oCBSelect As Office.CommandBarButton
            Dim oInsp As Outlook.Inspector
            Dim oCont As Outlook.MailItem
            Set oApp = New Outlook.Application
            Dim oInspLeft As Integer
            Dim oContTo As String
            Dim oContCC As String

            Set oCont = oApp.CreateItem(olMailItem)
            If mstrEmailTo <> "" Then
                'objRecipients.AddMultiple mstrEmailTo, CdoTo
                oCont.To = mstrEmailTo
            End If
            If mstrEmailCC <> "" Then
                'objRecipients.AddMultiple mstrEmailCC, CdoCc
                oCont.CC = mstrEmailCC
            End If

            'Set objNewMsg.Recipients = mobjSession.AddressBook(objRecipients, "Select recipients for the Daily report ...", , True, 2)
            Set oInsp = oCont.GetInspector
            oInsp.Display vbModeless
            oInsp.WindowState = olNormalWindow
            oInspLeft = oInsp.Left
            oInsp.Left = -10000 'Set the Inspector off screen.
                                'Set to 250 to return it to viewable location

            Set oCB = oInsp.CommandBars("Menu Bar")
            Set oCBTools = oCB.Controls("&Tools")
            Set oCBSelect = oCBTools.Controls("Address &Book...")

            oContTo = oCont.To
            oContCC = oCont.CC
            oCont.Close olDiscard
            oInsp.Left = oInspLeft
            Set oCont = Nothing
            Set oCBSelect = Nothing
            Set oCBTools = Nothing
            Set oCB = Nothing
            Set oApp = Nothing`

Related Questions