Excel VBA Renaming ActiveX ComboBoxes Issue - excel

I have a general question for which there are no code snippets. When an already existing worksheet ActiveX combo box has been renamed using VBA, why does the entire workbook need to be reopened in order for its name property to fully refresh/sync?
Is there a workaround that I am missing?
Also, a comment on the external link below notes a similar issue:
https://www.mrexcel.com/board/threads/vba-how-to-change-the-name-of-an-existing-combobox.1082608/
Example:
In this particular use case, I am looping through the OLEObjects collection and filtering specific OLEObjects into a standard collection. When i change the name property, I am referencing the standard collection items.
The name changes will reflect on the worksheet but not in the backend properties of the OLEObjects until the workbook is closed and reopened.

Well, it appears in the example, my code was lacking something. I was getting confused as to what was automatically occurring via Excel itself versus programmatically on my end.
UPDATE:
Another major cause of the problem, which I discovered via intensive debugging!!! If you rename any ActiveX combo box to include the "!" symbol, the boxes will experience issues when trying to communicate with any VBA events code - even after the boxes are renamed again later to not include such a symbol. Closing and reopening the workbook refreshes the bugs out of the combo boxes at that point.
If you try to add the "!" symbol to a regular event procedure name, you will receive an error. I am assuming this bug is inadvertently triggered by renaming the box to include that symbol. Warning: This may apply to other symbols but has not been tested. My situation was very unique in this case.
Another important point to emphasize: if your code involves renaming ActiveX combo boxes and any two or more boxes share the same name at some point throughout the code, this will cause a bug with any events code listening in the worksheet module until the workbook is closed/reopened. This bug occurs even if no two boxes share the same property name by the end of the procedure.

Related

Cannot run the macro Listbox4_Change. The macro May not be available in this workbook or all macros disabled

Can anyone please help me with excel issue. I have created a dynamic dashboard in excel using sumifs on data layer and index match functions on presentation layer. I have placed a simple List box form control with no VBA or macro.
My dashboard was working fine, without any issue, but on final step I was just trying to make the List box control float on the sheet with scrolling.
I found a vba code, I opened vba from developer mode, pasted code, but that deleted same.
Since then upon any selection of List box item, it is giving me error “ Cannot run the macro Listbox4_Change. The macro May not be available in this workbook or all macros disabled.”
I have tried pretty much every thing I found on google. Created a macro and deleted, copied one line code in all sheets of vba and deleted, enabled Macro security setting, but nothing really is working .
I am stuck badly.
It sounds like you've added a macro and then removed it, but haven't removed the macro assignment on the list box.
Right-click on the control and choose Assign Macro, delete the Macro name, and hit OK.

activeX combo boxes

I have a complex workbook that has a number of ActiveX Combo boxes which I choose over form controls for their customization options. Inexplicably, ALL of the boxes stopped working this morning. Literally, one minute they worked and then stopped completely. I was not working on that sheet, but rather a different one. There is no code attached to the combo boxes. When in design mode, the properties box doesn't even come up. Developer>Properties opens the worksheet properties only. This problem is not associated with the workbook because older versions of the same sheet are acting the same way. However, the compiled version of the workbook works fine. This suggests corruption in Excel somehow, so I repaired Excel (Office 365). No difference.
I deleted the combo box and replaced it and it is ok now, but that's not good enough for me. I have many others to remove and replace, but why do I need to do this? There are 180 other boxes that this happened to in the past and I simply used Data Validation for because I could not have this happen. I distribute this workbook in a compiled version only, so if I was certain that this bizarre occurrence could not happened once its compiled, I will replace all of the boxes that don't work and replace all of the data validation boxes with activeX, and compile it immediately. But I like things to make sense. What the heck is going on?
An ActiveX combo box has it's code on the sheet module for the sheet it is in. So, it's not odd that looking for the properties of the combo box that the sheet module would pop up. When in design mode and you right click on the combo box a pop up menu should come up that allows you to click and see the box's code on the sheet module. Are you saying that all the code for the boxes vanished or you had never written it? How do they get populated? I apologize for commenting in the answer section but I don't have enough points yet to write in the comment section.
The fact that no one has answered this suggests that this is behavior that I am causing. My belief at this point is that there is code running in the background which suspends other activity. I have a pop up calendar that ends with a range selection. I believe that this is looping somehow.
I am going to replace the data validation boxes with more combo boxes throughout the sheet with the calendar code in mind.

Data validation arrow does not show automatically

The arrow box next to all data validation fields in my xlsm file does not show automatically when clicking in the validation cell. It shows up quickly and disappears immediately. When clicking where the arrow box is supposed to be, the data validation options show up as usually and now the arrow box shows up permanently until I select and option.
Any hints how to solve this? Thanks!
Check similar unsolved problem
File>Options>Advanced>For objects, show: ALL is enabled (and doesn't change anything)
open & repair didn't solve the issue either
PD: I use VBA a lot in this workbook but none should access the dropdowns.
EDIT: I imported a sheet from a different workbook where the arrow is displayed normally and the same issue occurs.
EDIT2: On some worksheets the issue does not occur. By creating a new data validation field on such a sheet and going back to a corrupted sheet, the arrow box shows up perfectly...
I found out that this issue is only related to the speed of the Excel Sheet itself.
I had various linked pictures in the workbook that made it very slow, resulting as well in the data validation arrow issue.
Removing the linked pictures would improve the performance and resolve the issue.
(Previously I had a workaround that seemed to work sometimes: I could solve the issue by creating a macro in "ThisWorkbook" that goes on two sheets and selects the fields with data validation activated:
Sheet("1").Range("DataValidation1").Select
Sheet("2").Range("DataValidation2").Select
Strange enough, this was sufficient to solve the problem. )

Data Validation Drop Down Box Arrow Disappearing

I have recently been having issues in one of my Excel sheets, I have created a data validation drop down box that refers to a list in an adjacent column (unhidden).
Until today when I clicked on the cell, the drop down arrow appeared but now it briefly flashes before disappearing again, if you click on the right of the cell it still lets you make the selection but other people will use this sheet so it's not really acceptable.
I have checked that the data validation 'In-cell drop down' box is ticked and I don't know where to go from there, has anyone else had this problem? (Google has not been very helpful).
Thank you
I had the same problem and found out that this issue was in my case only related to the speed of the Excel Sheet itself. I had various linked pictures in the workbook that made it very slow, resulting as well in the data validation arrow issue.
Removing the linked pictures would improve the performance and resolve the issue.
(Previously I could resolve it with a workaround by creating a macro in "ThisWorkbook" that goes on two sheets and selects the fields with data validation activated when the workbook is launched:
Sheet("1").Range("DataValidation1").Select
Sheet("2").Range("DataValidation2").Select
Strange enough, this was sufficient to solve the problem.)
I've never personally seen this but have you tried it on another computer or as another user on your computer? I think it just might be some temp files or cache from office that is causing this issue.

Formulas within a table that reference an external workbook cause warning message when updating links

If I add a formula referencing another workbook, and the formula is within a table, the warning message "Warning: Open source to update values" is displayed when manually updating links.
I am using Excel 2010, but I can also observe the same behavior using Excel 2013.
Steps to reproduce the behavior:
Create a workbook named A.xlsx and save it to your desktop.
Create a workbook named B.xlsx and save it to your desktop.
Open B.xlsx and insert a table on any spreadsheet. On any column of the table, add a formula that references A.xlsx, e.g. a formula directly refencing a cell on A.xlsx.
On the Data tab, in the Connections group, click Edit Links. Chose A.xlsx as the source and click on "Update Values". The warning message "Warning: Open source to update values" is displayed.
All the values seem to be updated without errors, despite the warning message.
Question: Is this warning message spurious, or does it really indicate a failure to update the linked values in any way?
As noted above, the values seem to be correctly updated in my tests, but the warning message is still a bit disturbing as it may indicate some issue I was not able to detect.
If I précis what is detailed here I may corrupt the proper explanation but as I understand it, basically this is to warn you that the workbook in which you see this message is using values stored in that workbook to represent those linked to in the other workbook. If the other workbook is closed the stored values may not have been updated by changes in the other workbook so to be sure open the other workbook to refresh the links.
If the other workbook is actually open at the time then I presume it is either an anomaly of Tables or perhaps a warning to cover a situation such as a link to an ‘open’ PivotTable but one that may not be in a refreshed state.
As far as the workbook with the warning is concerned the data is 'clean' but it is unable to read 'dirty' flags in the other workbook.
I'm only a recent user, and i was experiencing the same thing- after some research i came across this code-
I adapted it for my own workbook and pasted it in the "ThisWorkbook" object in VBA for the destination workbook.
What it does is temporarily open/refresh/save and close the source application. If the connection to your source file is ok, it shouldn't take too long to update, but do be careful while trying to open it without a connection.
Private Sub Workbook_Open()
Workbooks.Open ("C:\Users\address_of_source_workbook")
Dim i As Integer
For i = 1 To ActiveWorkbook.Connections.Count
ActiveWorkbook.Connections.Item(i).Refresh
Next i
Workbooks("name_of_source_workbook").Save
Workbooks("name_of_source_workbook").Close
End Sub
Hope this helps!

Resources