Typing May Be Good For You

I have written previously about User Defined Types, where I showed what I feel is a good, legitimate use of UDTs, namely the saving of application settings at the start of my procedures, then re-instating them at the end. I have since extended that technique to make it more generic, as follows Public Type ApplicationValues    AppEnableEvents As Boolean    AppScreenUpdating As Boolean    AppDisplayAlerts As Boolean    AppCalculation As XlCalculation End Type Public Function DoSomeStuff() Dim myAppSettings As ApplicationValues     Call AppSettings(State:=”Set”, _                 AppType:=mpAppSettings, _                 AppEvents:=True, _                 AppScreen:=False, _                 AppAlerts:=False, _                 AppCalc:=-1)     On Error GoTo func_error  … main code    func_exit:     Call … Continue reading Typing May Be Good For You

What’s My Type?

I am a big advocate of using the Enum construct in VBA, I feel that it is a simple way of adding a set of values, and provides a grouping, abstracting advantage that is not given by simple variables. Plus they can add to intellisense. As such, I should also be a fan of another specialised construct, the Type statement, but it is quite the opposite, I naturally avoid it. This is not because I think the Type statement is a bad concept, in fact I think the basic idea is great, but more because of its implementation; whenever I … Continue reading What’s My Type?