Code worked in 2010 but not in 2016 RRS feed

  • Question

  • Thank you for taking the time to read my question.

    I created the following code in 2010 but upgraded to 2016 and for some reason it does not work on my new laptop but it continues to work on my old laptop (2010).

    Public Sub GetCellName_Access(objMailPrev As Outlook.MailItem)
    Dim tMsg As String
    Dim olApp As Outlook.Application
    Dim objMail As Outlook.MailItem
    'Dim objMailPrev As Outlook.MailItem
    Dim tPhone As String
    Dim tPerc As Integer
    Dim objData As New MSForms.DataObject
    Dim objNewMail As Outlook.MailItem
    Dim Spent As Boolean
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim strSQL As String
    On Error GoTo GetCellName_Access_Err
    'Set objMailPrev = Application.ActiveExplorer.Selection(1)
    Set objMail = objMailPrev.Forward
    Spent = False
    'MsgBox "Telus No Reply"
    tPhone = objMail.Body

    This works fine when I call it from a Rule.

    However if I want to call it manually I used this in 2010:

    Sub GetCellName_Manual()
     GetCellName_Access (Application.ActiveExplorer.Selection(1))
    End Sub

    In 2016 I get an error when I run GetCellName_Manual()

    Run-time error '438':

    Object doesn't support this property or method

    I have also verified that my References are the same in both laptops.

    What has changed in 2016? 

    Thank you

    Wednesday, August 22, 2018 9:00 PM


  • Solution:

    GetCellName_Access (Application.ActiveExplorer.Selection(1))

    Should be

    GetCellName_Access Application.ActiveExplorer.Selection(1)

    • Marked as answer by mbrad Tuesday, September 18, 2018 8:57 PM
    Tuesday, September 18, 2018 8:57 PM