+ Reply to Thread
Results 1 to 25 of 25

Error: automation error the object invoked has disconnected from its clients

Hybrid View

siroos12 Error: automation error the... 12-14-2013, 04:14 PM
siroos12 Re: Error: automation error... 12-15-2013, 04:54 PM
jaslake Re: Error: automation error... 12-15-2013, 07:48 PM
siroos12 Re: Error: automation error... 12-16-2013, 04:47 AM
jaslake Re: Error: automation error... 12-16-2013, 11:16 AM
siroos12 Re: Error: automation error... 12-16-2013, 12:31 PM
jaslake Re: Error: automation error... 12-16-2013, 12:41 PM
Norie Re: Error: automation error... 12-16-2013, 12:47 PM
siroos12 Re: Error: automation error... 12-16-2013, 12:58 PM
Norie Re: Error: automation error... 12-16-2013, 01:02 PM
siroos12 Re: Error: automation error... 12-17-2013, 08:40 AM
Norie Re: Error: automation error... 12-17-2013, 08:49 AM
siroos12 Re: Error: automation error... 12-17-2013, 09:27 AM
siroos12 Re: Error: automation error... 12-17-2013, 09:41 AM
Norie Re: Error: automation error... 12-17-2013, 09:47 AM
siroos12 Re: Error: automation error... 12-17-2013, 10:11 AM
Winon Re: Error: automation error... 12-23-2013, 07:18 AM
siroos12 Re: Error: automation error... 12-23-2013, 01:06 PM
Winon Re: Error: automation error... 12-23-2013, 01:26 PM
siroos12 Re: Error: automation error... 12-23-2013, 01:44 PM
Winon Re: Error: automation error... 12-24-2013, 08:56 AM
  1. #1
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Error: automation error the object invoked has disconnected from its clients

    Good day all,

    I built a vba userform in my excel file and frequently receiving "automation error the object invoked has disconnected from its clients" error. Some times it works and some times it is not. I have comboboxes in the form, by choosing the comboboxes some times it does not show the range on itself and some times it just give me "Run Time" Error and close the excel.
    it does confuse me because it happens some times not always.

    I do appreciate in advance for your help.

    Cheers.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Error: automation error the object invoked has disconnected from its clients

    I just read lots of articles bout this error but could not handle how to solve it. the latest article was "INFO: Error or Unexpected Behavior with Office Automation When You Use Early Binding in Visual Basic" so I considered i need to do qualifying my code but i do not know how?!

    here is the codes which I wrote on a excel vba userform:

    Private Sub CommandButton1_Click()
    Application.Calculation = False
    Worksheets("Data Base").Activate
    
        MSG1 = MsgBox("Do you want to submit the form?", vbYesNo)
        If MSG1 = vbYes Then
            Dim ssheet As Worksheet
            
            Set ssheet = ThisWorkbook.Sheets("Data Base")
    
            nr = ssheet.Cells(Rows.Count, 2).End(xlUp).Row + 1
    
                ssheet.Cells(nr, 2) = Me.TextStockNo
                ssheet.Cells(nr, 3) = Me.ComboRepName
                ssheet.Cells(nr, 5) = Me.DTPickerDate
                ssheet.Cells(nr, 6) = Me.TextYearModel
                ssheet.Cells(nr, 7) = Me.ComboVehicleMake
                ssheet.Cells(nr, 8) = Me.TextDescription
                ssheet.Cells(nr, 9) = Me.TextRegNo
                ssheet.Cells(nr, 9) = Me.TextMileage
                ssheet.Cells(nr, 11) = Me.ComboColour
                ssheet.Cells(nr, 12) = Me.TextBought
                ssheet.Cells(nr, 13) = Me.TextSold
                ssheet.Cells(nr, 15) = Me.ComboDealer
                ssheet.Cells(nr, 16) = Me.ComboAdvert
                ssheet.Cells(nr, 17) = Me.TextAddComments
                ssheet.Cells(nr, 18) = Me.DTPickerInvoiceDate
                ssheet.Cells(nr, 19) = Me.TextInvoiceNo
                
                
            MSG2 = MsgBox("Do you want to input new field?", vbYesNo)
            If MSG2 = vbYes Then
            Unload Me
            Worksheets("Data Base").Activate
            userform1.Hide
            userform1.Show
            Else
            Unload Me
            End If
    
    
        Else
           Unload Me
           Worksheets("Data Base").Activate
           userform1.Hide
           userform1.Show
         End If
    
     Application.Calculation = True
    End Sub
    
    
    
    Private Sub CommandButton2_Click()
     Unload Me
    End Sub
    
    Private Sub CommandButton3_Click()
    Unload Me
    Worksheets("Data Base").Activate
    userform1.Hide
    userform1.Show
    End Sub
    
    Sub Open_Form()
        Worksheets("Data Base").Activate
       
        userform1.Show
        
        
    End Sub
    It is a data entry form which gives the user options to reset the form, submit or reload it. I it works fine at same time but as long as I submit for first time and reload it to submit next item it gives me that error.

    I checked it on another pc and it works fine, I am not sure what is wrong with my pc.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Error: automation error the object invoked has disconnected from its clients

    Hi siroos12

    With Code changes in the attached I get no indication of this
    as long as I submit for first time and reload it to submit next item it gives me that error
    Let me know of issues.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Error: automation error the object invoked has disconnected from its clients

    Thanks jaslake,

    I see the deferences. I just opened the file and it worked first time that I open the form. on second time when I try to open combo boxes it just close the excel. now I considered if i close the excel file and re open it it does not work even on first time.
    Last edited by siroos12; 12-16-2013 at 04:50 AM.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Error: automation error the object invoked has disconnected from its clients

    Hi siroos12

    I'm not able to duplicate this on the Sample File. Are you getting this behavior on the Sample File or your Live File?
    on second time when I try to open combo boxes it just close the excel. now I considered if i close the excel file and re open it it does not work even on first time.

  6. #6
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Error: automation error the object invoked has disconnected from its clients

    Hi there,

    I just downloaded your file and try to test it.

  7. #7
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Error: automation error the object invoked has disconnected from its clients

    Thanks my friend,

    I am building this for a customer, lets hope that they use 2007 or 2010. By the way i just removed the part of cod which unload and show the form again after submitting first record. It works now but i need to press the button to add next record which is not too bad

    I do appreciate all others if they can help.

    Thanks.

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Error: automation error the object invoked has disconnected from its clients

    You're welcome...sorry I couldn't help...best of luck.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Error: automation error the object invoked has disconnected from its clients

    What happens if you remove the DTPicker controls?

    Also, have you tried populating the comboboxes in the Initialize event rather than using the RowSource property?

    For example.

    
        With Worksheets("Ranges")
            Me.ComboRepName.RowSource = ""
            Me.ComboRepName.List = .Range("A2", .Range("A" & Rows.Count).End(xlUp)).Value
            Me.ComboVehicleMake.RowSource = ""
            Me.ComboVehicleMake.List = .Range("C2", .Range("C" & Rows.Count).End(xlUp)).Value
            Me.ComboColour.RowSource = ""
            Me.ComboColour.List = .Range("E2", .Range("E" & Rows.Count).End(xlUp)).Value
            Me.ComboDealer.RowSource = ""
            Me.ComboDealer.List = .Range("G2", .Range("G" & Rows.Count).End(xlUp)).Value
            Me.ComboAdvert.RowSource = ""
            Me.ComboAdvert.List = .Range("I2", .Range("I" & Rows.Count).End(xlUp)).Value
        End With
    If posting code please use code tags, see here.

  10. #10
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Error: automation error the object invoked has disconnected from its clients

    Hi Norie.

    I will give it try but i do not know how to initialize the comboboxes. i need to google it

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Error: automation error the object invoked has disconnected from its clients

    The code I posted is for populating the comboboxes.

    It would go in the Initialize event of the userform.

  12. #12
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Error: automation error the object invoked has disconnected from its clients

    Dear Norie,

    Is it going to be like this?
    Option Explicit
    Private Sub CommandButton1_Click()
        Dim MSG1 As String
        Dim nr As Long
        Dim ssheet As Worksheet
    
        If Me.TextStockNo = "" Then
            MsgBox "Form incomplete"
            Exit Sub
        End If
        
      
        '    Application.Calculation = False
        Set ssheet = ThisWorkbook.Sheets("Data Base")
        MSG1 = MsgBox("Do you want to submit the form?", vbYesNo)
        If MSG1 = vbYes Then
       
          With Worksheets("Ranges")
            Me.ComboRepName.RowSource = ""
            Me.ComboRepName.List = .Range("A2", .Range("A" & Rows.Count).End(xlUp)).Value
            Me.ComboVehicleMake.RowSource = ""
            Me.ComboVehicleMake.List = .Range("C2", .Range("C" & Rows.Count).End(xlUp)).Value
            Me.ComboColour.RowSource = ""
            Me.ComboColour.List = .Range("E2", .Range("E" & Rows.Count).End(xlUp)).Value
            Me.ComboDealer.RowSource = ""
            Me.ComboDealer.List = .Range("G2", .Range("G" & Rows.Count).End(xlUp)).Value
            Me.ComboAdvert.RowSource = ""
            Me.ComboAdvert.List = .Range("I2", .Range("I" & Rows.Count).End(xlUp)).Value
        End With
            With ssheet
                nr = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
                .Cells(nr, 2) = Me.TextStockNo
                .Cells(nr, 3) = Me.ComboRepName
                .Cells(nr, 5) = Me.DTPickerDate
                .Cells(nr, 6) = Me.TextYearModel
                .Cells(nr, 7) = Me.ComboVehicleMake
                .Cells(nr, 8) = Me.TextDescription
                .Cells(nr, 9) = Me.TextRegNo
                .Cells(nr, 9) = Me.TextMileage
                .Cells(nr, 11) = Me.ComboColour
                .Cells(nr, 12) = Me.TextBought
                .Cells(nr, 13) = Me.TextSold
                .Cells(nr, 15) = Me.ComboDealer
                .Cells(nr, 16) = Me.ComboAdvert
                .Cells(nr, 17) = Me.TextAddComments
                .Cells(nr, 18) = Me.DTPickerInvoiceDate
                .Cells(nr, 19) = Me.TextInvoiceNo
            End With
        End If
        Call UserForm_Initialize
    
        '    Application.Calculation = True
    End Sub

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Error: automation error the object invoked has disconnected from its clients

    No, the code goes in the form's Initialize event.
    Private Sub UserForm_Initialize()
    
       With Worksheets("Ranges")
            Me.ComboRepName.RowSource = ""
            Me.ComboRepName.List = .Range("A2", .Range("A" & Rows.Count).End(xlUp)).Value
            Me.ComboVehicleMake.RowSource = ""
            Me.ComboVehicleMake.List = .Range("C2", .Range("C" & Rows.Count).End(xlUp)).Value
            Me.ComboColour.RowSource = ""
            Me.ComboColour.List = .Range("E2", .Range("E" & Rows.Count).End(xlUp)).Value
            Me.ComboDealer.RowSource = ""
            Me.ComboDealer.List = .Range("G2", .Range("G" & Rows.Count).End(xlUp)).Value
            Me.ComboAdvert.RowSource = ""
            Me.ComboAdvert.List = .Range("I2", .Range("I" & Rows.Count).End(xlUp)).Value
        End With
    
    End Sub
    By the way, have you tried removing the DTPickers? That was kind of the main point of my post.
    Last edited by Norie; 12-17-2013 at 08:56 AM.

  14. #14
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Error: automation error the object invoked has disconnected from its clients

    yes i did. but does not help. let me try this code and will update you.

  15. #15
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Error: automation error the object invoked has disconnected from its clients

    Thanks Norie, it does not give me that error any more but new issue. the "reset form" button does not work any more. and I need a message box popup after submitting the form says: "Do you want to submit new record?" with yes/no buttons.so by pressing submit button msgbox says "do you want to submit?". by pressing "yes" I need the next msgbox "Do you want to submit new record?" popup and by pressing "yes" reset the form and by pressing "no" close the form. how do I do that?

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Error: automation error the object invoked has disconnected from its clients

    What I posted shouldn't affect anything else.

    Did you remove/change any of the existing code?

  17. #17
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Error: automation error the object invoked has disconnected from its clients

    Wow it works now, it was my mistake! i added your code to the file that "jaslake" provided. I just added it to my initial file and it works stunning. Thanks a lot guys.

  18. #18
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Error: automation error the object invoked has disconnected from its clients

    Hello siroos12,

    Jaslake and Norie have gone to great lengths helping you to solve your issue.

    Please be so polite as to at least mark this Thread as Solved.

    Thank you.

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  19. #19
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Error: automation error the object invoked has disconnected from its clients

    Hi Winon,

    I really do appreciate of their help. I did not want to be impolite my friend but if I did something wrong I am sorry for that and thank a lot for their help and your comment as well. thanks all.

    I do not know how to mark it solved? I wanted to do it before but i did not know how to?!
    Would you please tell me how to do that?

    Best regards.

  20. #20
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Error: automation error the object invoked has disconnected from its clients

    Hello siroos12,

    That is the way to go, thank you for your feedback.

    Go to each Post of everyone that has offered you a solution, and click on the Star * to the far left at the bottom of that Post, and add to their Reputation.

    Then go to your first Post, and above the Post Screen, select Thread Tools> Solved.

    Thank you kindly.

    Regards.

  21. #21
    Registered User
    Join Date
    08-11-2013
    Location
    SA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Error: automation error the object invoked has disconnected from its clients

    I will do it now, and will do on my other post later as well. thanks a lot.

  22. #22
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Error: automation error the object invoked has disconnected from its clients

    Hello siroos12,

    Thank you for your kind co-operation.

    Merry Christmas to you, and all you nearest and dearest.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 11-22-2013, 11:56 AM
  2. 2147417848 automation error the object invoked has disconnected from its clients
    By KasiaFavourite in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2011, 10:44 AM
  3. -2147417848 automation error the object invoked has disconnected from its clients
    By ajaykgarg in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-12-2011, 08:10 AM
  4. Automation Error: "The object invoked has disconnected from its clients"
    By cartman44 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2009, 04:51 PM
  5. Automation Error : The Object Invoked Has Disconnected From Its Clients !!
    By donna.gough@hydro.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2005, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1