Excel 2010 :
1)
Excel Macro contains "Properties,View Code and CommandButton Object menus on right click.
2)
Same Excel Macro does not show "Properties,View Code and CommandButton Object menus on right click.
What is the reason,not showing menus.How to get this properties.I would have tried to changing excel properties.
There are two different kinds of controls possible in an Excel worksheet.
Both can be inserted via developer tab:
Your first one is an ActiveX control.
Your second one is an Form control.
See also: What is the difference between "Form Controls" and "ActiveX Control" in Excel 2010?
Related
I've just started a new contract and am working with Office VBA again after about 20 years. There is a spreadsheet I'm working on where command buttons disappear after the document saves. I've been reading other threads that suggest as a fix setting the size of the button after saving. However, I can't figure out how to identify that button in code.
When I click "Format", there is no place where the name of the object appears. There's a macro attached to it, but I see no way to identify the "sender" when the macro fires.
The macro pops up a form, and after the user enters some information and submits, it saves the sheet, and the button goes "poof".
Is there any way to get the name of the button in the macro so I can resize it?
Thanks!
If you right-click the button, its name appears in the upper left hand corner of the spreadsheet in the Developer ribbon, right below the "Visual Basic" and "Macros" menu items. In my case, it was "Button 1".
Accessing it was non-intuitive for a guy used to working with full-blown .NET apps, but the button is a "Shape". So, addressing the button is accomplished with the identifier ActiveSheet.Shapes("Button 1"). With this object, you can access its properties and methods.
I have working .xlam application that contains a custom ribbon. This works great but the menu items under my tab sometimes disappear. I would like to add an onAction to the main tab for the add-in in the ribbon's CustomUI.xml but Excel must see this as a syntax error in the .xml and doesn't load the ribbon.
Is there a way to get an OnAction to fire when the ribbon's tab is clicked?
The Office Fluent UI (Ribbon X) schema does not define/allow an onAction attribute for a tab control.
So, no, what is asked in the question is not allowed / not possible.
I made an excel macro that retrieves data from other workbooks. I need to add a button to the Excel Ribbon for this Macro. The kicker: I need this button to go into a tab called "Special". This tab was part of an add-in and currently only contains one button. This "Special" Tab cannot be found in the customize ribbon area in the options tab.
Also, would it be better to turn my one macro into an add-in or should I just add the one macro to the ribbon.
Thank you all very much in advanced.
I am working with a custom ribbon in Excel (VBA + XML).
I was wondering if there is a control that would emulate the "Styles" functionality from the Home tab of Excel, that being a 2 rows x 3 columns gallery displayed directly in the ribbon, not by clicking a button.
Can anyone let me know if such a control exists and what is it called?
Thank you
Could someone please explain to me the difference between the combo box that's available via the Developer Ribbon in Excel 2007 vs. the Combo Box control that's in the VBA editor? I cannot get this simple line of code to work using the Developer combo box:
MsgBox Combo1.Value
I've tied it to the change event and it seems to be syntactically correct (I'm not a VBA coder by any stretch).
Is the Developer Ribbon version some bastardized craptastic Microsoft shortcut?
What I'm trying to do is populate a second combo box based on the selection of the first combo box. I'd rather not build a case statement for every possible selection. Is this possible using the Developer ribbon version?
You are talking about the Insert button on the Developer tab correct? From that button you can add an ActiveX control or Form control. You're better off using the form controls if your new to programming as they will behave more in line with any Excel VBA reading you've done and the help file. With the Form controls you can right click and choose 'View Code' and/or 'Rename Control and Code'. Renaming the control allows you to address it in VBA however you like. e.g. - Combo1.value or myFavoriteCombo.value
That being said, to answer your question directly, be sure you know the controls full name. If you used a form control and it was the first one you put on the sheet it will be named ComboBox1. To get to the combobox's properties you have to walk through it's 'parent' sheet.
i.e.
MsgBox Sheet1.ComboBox1.value (using the sheet's code name)
or
MsgBox Worksheets("SheetName").ComboBox1.value (using the sheets name as it appears on the Excel tab)