This is a discussion on OLEObject error after Office Update within the Excel Questions forums, part of the Question Forums category; Hi, for several years I use this code to hide/show buttons on Ws and change their caption Code: Dim cBtn ...
for several years I use this code to hide/show buttons on Ws and change their caption
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 workCode: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 Else cBtn.visible = True s = "some button caption" cBtn.Caption = s End If End If End If nextC: Next
says: Unable to get the Object property of the OLEObjet class.Code:If TypeOf oleObj.Object Is MSForms.CommandButton Then
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...
If there's something in my code you could do better, please let me know!
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.
Microsoft MVP - Excel