none
Run-time error '429': ActiveX component can't create object”? RRS feed

  • Question

  • I am using access 2007 and am trying to use the code below to determine if Outlook is already open and if not exit the seb and warn the user.  I keep getting the 429 error.  HELP
       Dim objOutlook As Object
       Set objOutlook = GetObject(, "Outlook.Application")  
    
       If Err <> 0 Then Call Shell(SysCmd(acSysCmdAccessDir) & "OUTLOOK.EXE")
    

    Sunday, January 8, 2017 9:59 PM

Answers

  • I don't know what you have setup for error handling. For starters, I would expect an On Error statement before the initial 'Set'/ something like this:

     Dim objOutlook As Object
     On Error resume next   
     Set objOutlook = GetObject(, "Outlook.Application")  
       If Err <> 0 Then Call Shell(SysCmd(acSysCmdAccessDir) & "OUTLOOK.EXE")
    ...


    -MainSleuth


    • Edited by MainSleuth Sunday, January 8, 2017 10:30 PM
    • Marked as answer by Steve Staab Monday, January 9, 2017 4:01 AM
    Sunday, January 8, 2017 10:28 PM
  • You have to insert a line

    On Error Resume Next

    above the line Set objOutlook = ...


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by Steve Staab Monday, January 9, 2017 4:01 AM
    Sunday, January 8, 2017 10:32 PM
  • Hi Steve Staab,

    if you just want to check that outlook is open or not and if it is open then execute your code.

    then refer the code mentioned below.

    Sub TestOutlookIsOpen()
        Dim oOutlook As Object
    
        On Error Resume Next
        Set oOutlook = GetObject(, "Outlook.Application")
        On Error GoTo 0
    
        If oOutlook Is Nothing Then
            MsgBox "Outlook is not open, open Outlook and try again"
        Else
            'write your code here. it will execute if outlook is opened.
        End If
    End Sub


    but if outlook is closed and you want to open it then you can use code mentioned below.

    Sub TestMe()
    Dim outlook As Object
    On Error Resume Next
    Set outlook = GetObject(, "outlook.application")
    If Err.Number = 429 Then
      Err.Clear
      Shell ("OUTLOOK")
       'write your code here.
    End If
    
    End Sub

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Steve Staab Monday, January 9, 2017 4:02 AM
    Monday, January 9, 2017 3:08 AM
    Moderator

All replies

  • I don't know what you have setup for error handling. For starters, I would expect an On Error statement before the initial 'Set'/ something like this:

     Dim objOutlook As Object
     On Error resume next   
     Set objOutlook = GetObject(, "Outlook.Application")  
       If Err <> 0 Then Call Shell(SysCmd(acSysCmdAccessDir) & "OUTLOOK.EXE")
    ...


    -MainSleuth


    • Edited by MainSleuth Sunday, January 8, 2017 10:30 PM
    • Marked as answer by Steve Staab Monday, January 9, 2017 4:01 AM
    Sunday, January 8, 2017 10:28 PM
  • You have to insert a line

    On Error Resume Next

    above the line Set objOutlook = ...


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by Steve Staab Monday, January 9, 2017 4:01 AM
    Sunday, January 8, 2017 10:32 PM
  • Hi Steve Staab,

    if you just want to check that outlook is open or not and if it is open then execute your code.

    then refer the code mentioned below.

    Sub TestOutlookIsOpen()
        Dim oOutlook As Object
    
        On Error Resume Next
        Set oOutlook = GetObject(, "Outlook.Application")
        On Error GoTo 0
    
        If oOutlook Is Nothing Then
            MsgBox "Outlook is not open, open Outlook and try again"
        Else
            'write your code here. it will execute if outlook is opened.
        End If
    End Sub


    but if outlook is closed and you want to open it then you can use code mentioned below.

    Sub TestMe()
    Dim outlook As Object
    On Error Resume Next
    Set outlook = GetObject(, "outlook.application")
    If Err.Number = 429 Then
      Err.Clear
      Shell ("OUTLOOK")
       'write your code here.
    End If
    
    End Sub

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Steve Staab Monday, January 9, 2017 4:02 AM
    Monday, January 9, 2017 3:08 AM
    Moderator
  • Thanks guys.  All 3 reply's seem to work equally well.  I tested 2 of the 3 with no notable difference in performance.

    Thanks again

    Steve

    Monday, January 9, 2017 4:04 AM