I have a userform with multipage tabs, within each tab there is a "next" command button that allows you to move onto the next tab if there are no errors (if there is an error, it prompts the user and sets the focus to the error on that tab). When the userform is open, I can click the tabs to jump around without completing anything which defeats the purpose of my error handling.
Is there a way to disable tab selection? Or add a sub to the tab itself?
Thanks
Change the Style property of the Multipage to fmTabStyleNone (2).
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 am developing a quotation process with VBA in an Excel Worksheet. I placed an ActiveX Frame control with 2 option buttons inside.
As soon as I leave Design Mode, the buttons disappear. I have made sure the buttons are visible, have the correct width and height and I know they are there because I can access them pragmatically.
The problem is, I guess, with the Frame control that probably has a bug.
Any advice will be greatly appreciated.
Cheers, EOutlook
To add an option button to your frame, right-click the frame and choose "Frame object >> Edit" - add the option button from the toolbox which pops up, not from the Developer ribbon.
I have a custom tab in Excel (2013). On the tab, there is a menu that has multiple toggle buttons. It would be beneficial from a user standpoint that the menu would stay open until they are done with all their selections.
So I am looking for a way to keep the menu expanded after clicking any of the toggle buttons and the only way to close the menu is to click away from the menu. One thought that I had/looking for, is there any way through vba to expand a menu in the ribbon. So I would include that at the end of the sub-routine for each toggle button.
When I click on 'Calendar' or 'Generate Report' button. It doesn't do anything. what could be the problem. Please help me out. thank you.
Ok... Assuming you've enabled macros on your workbook correctly etc...
The Button.
There are 2 types of button. A form and a Active-x.
If this is a Forms type button - right click and assign the macro. Have your macro in a modules and not in a worksheet class.
The Button.
If this is an active-x button, on the Developer tab press the Design Mode icon, which funny enough, will put it in Design Mode :)
Double click the button, this will generate an event handler in the worksheet class.
The Calendar Control.
This is also an active-x so I would follow the steps for the active-x button. Enter design mode and double click. I think this will create a Click event handler where you can trap the event.
Hope that helps...
Either no macro is being assigned to your buttons or you are in design mode.
Right click on button and click on Assign Macro's and check if any macro is assigned
Go to Developer tab and check if you are in Design Mode
I have created a small UserForm in Excel. I have created Button1 and have enabled the tab index. When I tab from a drop down box to Button1, it assumes that I have hit enter on the button, just by simply tabbing to it. Is there a way to disable this?
I want the user to tab to Button1 and then actually hit Enter or click. I am not sure why simply clicking tab after previous item is running the macro in Button1_Enter.
Thanks.
Place you code in the Button1_Click event instead of the Button1_Enter. As Tim points out, "Enter" refers to receiving focus and not clicking of the button hence the behavior you've described.