Excel oleobject cannot delete - vba

I put date picker to my sheet and got a lot of problem
I cant select or delete thoose dtpickers nor manualy nor from VBA as this code
Dim obj As OLEObject
For Each obj In ActiveSheet.OLEObjects
obj.Delete
End If
Next
Return an error
application defined or object-defined error
I using Office 2013 32bit, other computers with Office 2010 32bit, Office 2007 32bit, Office 2013 32bit. I cant run compiled workbook on others computers, as i get in refences missing
microsoft windows common controls 2 6.0 sp6
Which also cannot be removed as is in use. I cannot uncheck it.
Most of my project functions and parameters such (Ucase, Mid, Left, wdAlignParagraphLeft) start getting error as undefined. Also all undeclared variables got the same error. Solving only by writing it with prefix VBA.Ucase, VBA.Mid and etc. and declaring all variables.
Also in developer tab insert control button not active anymore in all computers also in my computer too.
So question is? how to delete thoose dtpickers object and fix my project?
How to know what depend to microsoft windows common controls 2 6.0 sp6 library?

Remove protection from your sheet and then select and delete objects, after that go to VBA editor and uncheck this library from references and restart your Excel application.

Related

"VBAProject" name conflict

My issue involves PowerPoint Add-Ins all being named VBAProject.
Microsoft Office Pro Plus 2010 - PowerPoint 2010 32 bit
Running Windows 7 Pro SP1 64 bit
I have several add-ins for PowerPoint saved as .PPAM files. In any PowerPoint file I can (or should be able to) link add-ins to extend that presentation's functionality. Each .PPAM file is named differently. In the VBA IDE however, in the list of references, each add-in is called 'VBAProject'. There are multiple entries of 'VBAProject' each one showing a path to a different .PPAM file. The problem is that I cannot add a reference to more than one add-in because the same name assigned to each of these; VBAProject. This results in a name conflict. Using the add-in manager from PowerPoint design view I can see all the selected add-ins as being 'active'. The Add-in manager for the VBA IDE shows no Add-ins.
Questions:
Is the naming of PowerPoint Add-ins as 'VBAProject' expected for every add-in?
Is there a way of change the name 'VBAProject' to something unique and hence avoid the name conflicts?
So it seems as if I have found the solution to my problem and would like to share it with the community. It involved a small change to the registry. [Be careful when dealing w/ the registry and make a back-up prior to any changes.]
From Regedit.exe -> HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\PowerPoint\Options. Change value of DebugAddins from 0x00000000 (0) to 0x00000001 (1).
With this done you will be able to see all the add-ins in the VBA IDE and from there you can change the name 'VBAProject' to something unique.

Running functions from Excel Add-Ins in vba, is there an easier way than using Run "mySub"?

I'm trying to create my first Excel Add-In for Excel 2010. Most of it is working, it's running from the ribbon buttons, but I'm having trouble addressing the Add-In's subroutines from my workbook's VBA code.
According to this answer on SO, it should be possible to simply use the syntax:
mySub
or
Call mySub
But this causes the error "Sub or Function not defined". I've only managed to run them this way:
Run "mySub"
or
Application.Run("myAddIn.xlam!mySub")
Is there a way to include the Add-In so I can address it the easy way?
The Add-In is already checked in the Tools->Add-Ins list, and has a unique name (CalcFunctions) which is different from its file name (CalculationFunctions.xlam). The Add-In file is on a different disk and I'm working on a server, but I don't expect that that matters.
(Posted on behalf of the OP).
Turns out I'm just dumb. I only set a reference to the Add-In in the regular Excel window. I assumed that was what people meant by Tools->References->Add-Ins (I use Excel in Dutch and there's no "Tools" menu). Anyway, the solution was setting a reference in that menu in the VBA editor window.
Here's how to add a reference in VBA:
ThisWorkbook.VBProject.References.AddFromFile refPath
With refPath being the full path to the file.
To be able to add references you need to have permission to edit the VBA project. You can enable this in excel settings->trust center->macro settings. If you're on a company pc it's likely the administrator has to set these settings for you.

cant find object using reference in workbook

I'm trying to remove an old reference to Microsoft Office Web Components 11 (32 bit) in a workbook I'm updating, so it can run on office 365 (64 bit). I've removed all the objects I could find in sheets, and I've edited the code, so it now works, but I still get an error message saying:
Can't remove control or reference; in use
How do I find out where it is being used, so I can remove the reference and change it?

Is the versions 12 vs 14 Object Library causing Excel VBA “Code execution has been halted”?

I have an Excel 2007 running the 12 Object Library. The macros run fine when opening the workbook in Excel 2007. However, there is a “Code execution has been halted” message whenever the macros are run in Excel 2010 (the actual break occurs during a ListObjects.Unlink method). I F8 through the breaks but it keeps stopping at each ListObjects.Unlink.
I checked the references on both versions of VBE. The Excel 2007 runs the Object Library Version 12 and the Excel 2010 runs Version 14. There doesn’t seem to be an issue running any other code. Any ideas of what is happening?
Another post on this site recommended clicking debug and pressing [Ctrl+Break] twice to continue. Is there another work around?
Thanks

Listview on worksheet generates cannot insert object error Excel 2010

Hi I have an Excel 2003 application which has a listview embedded in the worksheet. It no longer works on Excel 2010.
I re-registered the ocx using regsvr32 C:\Windows\System32\MSCOMCTL.OCX as per advice.
This works for listviews on forms, but not for the worksheet.
Microsoft advises that Cannot insert object can be generated if the control is form specific and an attempt is made to add to the worksheet.
Can the listview be used in Excel 2010 on a worksheet
If so how?
Otherwise a rewrite will be required.
That happened to my Excel files using ActiveX or any sort of automation. The solution was confused at the beginning but the following link will help you.
Create a batch to remove cached control type libraries (extender files *.EXD) files from Windows
Opening each of the projects (Excel with macros)
Switch the file to design mode
Open VBA Code (Alt-F11) to edit any module and press from the main menu > Debug > Compile VBAProject
Switch back to Run Mode
Save and Close File
Reopen the file & test
Form Controls stop working after December 2014 Updates