-
Using Classes
Dear All. I've been using VBA (which is my first encounter with programming of any kind) for 9 months or so. So I'm fairly new to all this.
I'm currently putting together a spreadsheet-based application that makes extensive use of balloons. I never want multiple balloons to be open. So I've declared the balloon as a public object. I've then used various different routines to pop-up various different kinds of balloons. They're all of the basic form:
Code:
Public opBal as balloon
Sub PopUp(nIndex as long, in order to specify the text that should appear in the balloon)
Set opBal = nothing
Set opBal = New Balloon
Assistant.On = True
Assistant.Visible = True
Assistant....
'...etc, etc...
'(it seems necessary to specify these assistant settings each
'time I popup a balloon since, for some reason, my settings don't
'get remembered: perhaps the network I'm on automatically
'disables them or something, I don't know...
with opBal
.Heading(1) = ...text based on nIndex
.Text(1) = etc, etc
'...etc,
.close
'....
end with
end sub
From what little I can understand of such things, it seems to me that using classes should be able to make all this a bit neater and mean I don't need to repeat all the same set-up and close instructions at the tops and tails of my routines. Could someone give me some pointers please?