It been a while since I built a userform in Excel, so forgive me if this is something obvious. I have a userform containing a number of comboboxes. On opening the workbook, I populate them all with a list of reports stored in SQL, using the Workbook_Open macro.
However, when I close the userform and then reopen it, the comboboxes are empty. I that the way userforms work? Do you need to populate these boxes each time you launch the userform? I'm happy to do this but just wanted to check in case I'm missing a setting or a simple line of code.
Thanks
Related
I want to update a code of a macro-enabled excel file without changing anything on the sheets. The problem is upon opening the workbook, a userform automatically pops out which does something on a sheet upon filling up the form or just by closing it. The creator did not put some Admin button stuff to bypass the userform. How can I update a code inside the project and save it without altering the sheet contents or in other word, bypass the userform upon opening? Thanks in advance.
You need to open the file while pressing "SHIFT" held down. This way macros are not executed.
We have an excel workbook (xlsm) which has an embedded VBA code, which looks up the distance between two points using the getgoogledistance module.
Since we have added this to the workbook, it take a very long time to open sometimes in excess of 10 minutes..
I suspect on opening the workbook, it is trying to update all of the entries, hence why it is slow to open.
Is there a way in which I could add a button to the worksheet and rather than on 'open' update the necessary cells, when this button is clicked it updated all the cells?
Yes, you need to go to the options, then customize menu and from the list on the right, check the Developer menu.
Back to Excel, you'll be able to add controls such as push buttons and attach macros to them.
So I have programmed several userform with several user inputs(text boxes, check boxes, etc.) Now how can I use them outside of excel?
Currently I have to:
Open up the spreadsheet
Enable macros
Go to Developer Tab, View Code
Then find the right userform and run it or type F5.
Is there a more user-friendly way to run the userform? Its for testers who don't know vba or excel programming.
Thanks!
Yes, absolutely. You could create a button named after the form in question, and to that button assign the following macro:
Sub btn1()
frm1.Show
End sub
That's it! Of course, change the names according to what you have :)
I also reccomend having a button to close the form on the form itself.
OF COURSE this still uses Excel. If you want to use them on their own you could have something like this guy did: How to Open only UserForm of an excel macro from batch file
I created a userform that I would like to keep open on my desk top. Problem is I cannot open an existing excel spread sheet. I have to close my userform first or open the program excel and then open my worksheet. I cannot go to "my documents" and open an existing excel worksheet directly. Any idea's would be greatly appreciated. I am not the only person using the VBA userform.
Try setting the Userform's ShowModal property to False
i have wriiten a small vba code(userform & modules associated) for concatenating files in a user inputed folderpath. Currently i have this placed in personal.xls and everytime after opening excel i press ALT+F11 and go to the userform and run it (press F5).
I want this userform to be placed in as an addin or menu item in excel (available for all spreadsheets).
I know i need to assign a macro to a menu-item i add, but i have many subs (both in userform & modules associated) and not have instantiated my userform anywhere. i don't know which of these subs i need to assign to menu-item.
MAIN GOAL: is i wan't a menu item (or addin) which when i click pops up the userform. (afterwards running same as when i ran it from visual basic editor).
THINGS TRIED: i tried copying the userform & modules to a new project and saving it as an excel addin (.xla file) and placed the addin in excel add-ins folder. I have selected the addin from Tools>Addins option in excel. But, i think this way i was not able achieve what i needed as i don't see any new option/menu-item added to excel.
Thanks in advance
ps: I'm new to vba and just started working on it a week ago, so give me more detail in your answers.
You did it right with add-in but in order to use your code you need to add menus, check this out.