OLEObject error after Office Update


Active Member
Apr 7, 2010

for several years I use this code to hide/show buttons on Ws and change their caption
    Dim cBtn As MSForms.CommandButton
    Dim oleObj As OLEObject
    For Each oleObj In loDny.OLEObjects
        If TypeOf oleObj.Object Is MSForms.CommandButton Then
            Set cBtn = oleObj.Object
            If cBtn.Name = "cb_dny_overV" Then GoTo nextC
            If cBtn.Name Like "cb_dny*" Then
                i = CInt(Right(cBtn.Name, 2))
              If i > someNumber Then
                    cBtn.visible = False
                    cBtn.visible = True
                    s = "some button caption"
                    cBtn.Caption = s
                End If
            End If
        End If
so this has worked so far. Since yesterday (and I suspect but Im not sure it has something to do with recent office updates) this line does not work

 If TypeOf oleObj.Object Is MSForms.CommandButton Then
says: Unable to get the Object property of the OLEObjet class.

I tested on 2 w8.1 computers wth Office 2013 x64 and 1 w8.1 compuer with Office 2013 x86 but no luck :(
Im 100% sure I have made no changes, I have reular backups of my project and older versions don't work either...

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Andrew Poulsom

MrExcel MVP
Jul 21, 2002
From Office Update breaks ActiveX controls | Excel Matters:

It seems that a recent Office update has broken ActiveX controls on worksheets.

To fix it, do this:

1. Close all Office applications.
2. Do a search in Windows Explorer for *.exd files (note: that’s not *.exe !!) and delete any you find. Make sure you get this one: C:\users\username\AppData\Local\Temp\Excel8.0\MSForms.exd
3. Restart your Office apps and test the controls again.

Hopefully that will resolve the problem for you.

Watch MrExcel Video

Forum statistics

Latest member

This Week's Hot Topics

  • Copy entire row if CountA <>0 to another sheet
    [B]I want to copy entire row if CountA <>0 for column J7:AM7 (headers on J6:AM6) and so on till the last used cell is column D and paste the...
  • Select last used Row in Table
    I have created a Table in a Worksheet which is locked to prevent user errors and protect formula. Some of the cells require freetext entries which...
  • excel workbook: do not allow certain file name
    Hello all, Don't think this has ever been asked before, but how do I restrict file save [Before_Save Event] if the name of the file being saved...
  • fixing problem autofilter
    hello i need help about my code when i search by code in textbox it doesn't show anything this is my data [ATTACH type="full"...
  • “Weight”
    Hi, i’ve got a long sheet filled with weights such as kg,g,L & ml. i can build a formula to convert kg into g and liter into ml. How ever, my...
  • How to capitalize everything before a certain character?
    In column A, I have some text: Hello good day.mp3 Hello good day.flac etc. I'd like to capitalize everything before the period. I don't need the...