563 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Advanced controls in userforms with VBA macros
Part nine of a nine-part series of blogs
The two previous parts of this mini-blog have shown how to draw forms and how to write code to handle form events. This final part shows how to add some of the more exotic controls to user forms, like combo boxes, list boxes, multipage controls, spinners and option buttons.
If your form needs to get a date from a user, use the built-in Calendar control:
The vanilla version of the Calendar control, with default formatting.
You can add the Calendar control from the Toolbox:
Click on the Calendar tool, and click where you want this to go.
If you can't see the Calendar tool, you may need to install this additional ActiveX control. To do this, right-click on the Toolbox and choose Additional controls. It's amazing how many there are!
You can pick up on the Value property of a Calendar control to get the date chosen by a user:
'date of order
ActiveCell.Offset(0, 6).Value = Me.calDate.Value
Because the Calendar control isn't a standard tool in the Toolbox, some properties are hidden away in the Custom category:
Click in the Custom property and then click on the build button.
You can then play about with all sorts of formatting options in the dialog box which appears:
It's worth looking at all 3 tabs of this dialog box.
And with that, I've reached the end of this blog on advanced controls.
If you're wondering why I haven't included anything on the ToggleButton, ScrollBar or RefEdit controls, it's because I don't see the point in them. I'm willing to be persuaded otherwise by comments added to this blog.
|Parts of this blog|
25 Aytoun Street