VBA Run-time error '-2147417848(80010108)' with Userform

PegasusJF

New Member
Joined
Dec 7, 2007
Messages
26
I have this error, it is the first time I have experienced it after several successful executions of this program.

The error is this:

Run-time error '-2147417848(80010108)':
Automation error
The object invoked has disconnected from its clients.

The basic function of this macro is to run a two page userform (named “prodGroups”) to sift data to make it optimal for a pivot table.

The intent is to read a spreadsheet that has data (specifically, product types and production data) entered by many MANY different people. The most visible result of this is the product types may all be functionally the same thing, like "Tylenol 500mg 30ct", "Tylenol 250mg 30ct", and "Tylenol 500mg 30 ct." But the issue is these would be different items in the eyes of a binary match, when for example all this could be accurately described by “Tylenol 30ct.”

Basically the program takes in this messy data (the people who enter this data are not programmers.) makes it all nice and neat, ignores rows the lack key data cells and puts all the good rows (and only the relevant data columns) into another worksheet in the open workbook with all individual product names replaced with their specified groups.

I used this program once a quarter to give my boss production numbers for each work room and product we make. Only for this time I ran that error message above.

Pretty much the immediate aftermath is the program hangs, I can’t restart the macro, and I need to exit Excel via a process quit via task manager. But when I restart Excel I can run things normally again, and I have successful ran this macro.

Actually, this being the day after I first encountered this error (and started writing this), I haven’t been able to repeat the error. I’ve tried different amounts of data but I haven’t gotten it back. However, I have the function where the error occurs and the line highlighted.

Code:
'This function displays the userform to allow the user to select which product
'codes go into which group.
Function groupChooser() As Boolean
    Dim idx As Integer, rowIdx As Integer, colIdx As Integer
    
    Load prodGroups
    
    idx = 0
    rowIdx = 0
    prodGroups.pCodeList.ColumnCount = 1 'set to 2 for debug
    prodGroups.gCodeList.ColumnCount = 1
    prodGroups.pG_CodeList.ColumnCount = 1
    prodGroups.pG_GroupList.ColumnCount = 1
    
    Do Until productGroups(idx, 0) = "" 'runs until an empty cell is encountered

        prodGroups.pCodeList.AddItem ""
        prodGroups.pG_CodeList.AddItem ""
        For colIdx = 0 To 1
            If colIdx = 0 Then
                prodGroups.pCodeList.List(rowIdx, colIdx) = productGroups(idx, 0)
                prodGroups.pG_CodeList.List(rowIdx, colIdx) = productGroups(idx, 0)
            Else
                prodGroups.pCodeList.List(rowIdx, colIdx) = idx
                prodGroups.pG_CodeList.List(rowIdx, colIdx) = idx
            End If
        Next
        
        idx = idx + 1
        rowIdx = rowIdx + 1
    Loop
    
    prodGroups.MultiPage1.Value = 0
    prodGroups.Show ‘<-The error occurs here.

    groupChooser = True
    
End Function

This isn’t a severe problem, since it’s sporadic in nature, but I would prefer it be solved so I don’t have to leave any successor of mine having to puzzle over my code for a very hard to track problem.

Thanks

Jason
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top