Instantaneo
New Member
- Joined
- Dec 5, 2012
- Messages
- 28
Hi there,
I'm barely new to Excel VBA, and all I know about it I learned in a training couse I took a few months ago and from dozens of Google searches, so I might be doing some really-basic mistakes... sorry for that!
I'm building a GUI for a tool that uses SQL and txt files to run (built by another company), so I was challenged to use that knowledge from the VBA training course to try to develop the GUI in VBA... ok, maybe not the best language to create a GUI, but that's all I have (and all I can try to use).
So, I have a UserForm1 with 3 buttons: "General configuration", "Parameters configuration" and "Paths configuration". Each one of the buttons unload UserForm1 and open UserForm2/3/4. In UserForm2 ("General configuration"), I have some textboxes to be filled in and then a button saying "Update" to click.
I would want that when I click in "Update" button the moment is "saved" and in UserForm1 (when showed again) the date of "last updated moment" would be presented in a label.
What I did was adding in the UserForm2 code:
... and then in UserForm1:
... but it is not working. What am I doing wrong?
Also, another minor doubt: is there any way of diagnose our code? I mean, since I'm building a GUI of course I don't want the code to break somewhere. So I'm trying to run through every possible mistakes (e.g., a textbox that needs an integer), creating warnings and stuff like that to avoid problems. But is there a way of running "all possible" errors in our code? For instance, I managed to discover that when I have a "browse" button and I click Cancel in the folder search, the code crashes. But if I haven't clicked Cancel, I wouldn't know that and the user would face the issue. Hope you understand my doubt.
Thank you so much for your attention. Please forgive me for wasting your time if this is such a stupid mistake.
I'm barely new to Excel VBA, and all I know about it I learned in a training couse I took a few months ago and from dozens of Google searches, so I might be doing some really-basic mistakes... sorry for that!
I'm building a GUI for a tool that uses SQL and txt files to run (built by another company), so I was challenged to use that knowledge from the VBA training course to try to develop the GUI in VBA... ok, maybe not the best language to create a GUI, but that's all I have (and all I can try to use).
So, I have a UserForm1 with 3 buttons: "General configuration", "Parameters configuration" and "Paths configuration". Each one of the buttons unload UserForm1 and open UserForm2/3/4. In UserForm2 ("General configuration"), I have some textboxes to be filled in and then a button saying "Update" to click.
I would want that when I click in "Update" button the moment is "saved" and in UserForm1 (when showed again) the date of "last updated moment" would be presented in a label.
What I did was adding in the UserForm2 code:
Code:
Public date_update As Date
Public date_update_bool As Boolean
(...)
date_update = Now()
date_update_bool = True
... and then in UserForm1:
Code:
If date_update_bool = True Then
Config.Label_General.Caption = date_update
Else
Config.Label_General.Caption = "Not updated yet!"
End If
... but it is not working. What am I doing wrong?
Also, another minor doubt: is there any way of diagnose our code? I mean, since I'm building a GUI of course I don't want the code to break somewhere. So I'm trying to run through every possible mistakes (e.g., a textbox that needs an integer), creating warnings and stuff like that to avoid problems. But is there a way of running "all possible" errors in our code? For instance, I managed to discover that when I have a "browse" button and I click Cancel in the folder search, the code crashes. But if I haven't clicked Cancel, I wouldn't know that and the user would face the issue. Hope you understand my doubt.
Thank you so much for your attention. Please forgive me for wasting your time if this is such a stupid mistake.