Passing arguments to macros

V

VK

I did not program in VBA for another year and I seem lost it again.
Briefly:
I have 32 uniformed labels in my form. Each of them has to perform
an action onMouseDown. The action is the same, the difference is
in the label to handle.
How to have a single sub/function called on event and have the
clicked label's ref or name passed to it? I tried a macro set
on the properties sheet, but I cannot get how to pass
different arguments to it.
 
D

Douglas J. Steele

Labels? I don't think it's possible. Other controls (like text boxes),
create a function (not a sub), and assign that function name as the
property for the event for all 32 controls. In the function, refer to
Screen.ActiveControl.Name to know the name of the control that's responsible
for the event. Remember that you can make text boxes act like labels.
 
G

Guest

To make a TextBox act like a Label, set the Disabled property to True, the
Enabled property to False and the Back Style to Transparent. You can set the
Value using the Control Source property (=WhatWouldHaveBeenTheCaption) or at
Runtime with VB.

If you don't want to convert the Label to a Textbox, you can Subclass the
controls. This method is more advanced, but also more accurate and generally
neat to know. Need more?
 
V

VK

matarcallarse said:
If you don't want to convert the Label to a Textbox, you can Subclass the
controls. This method is more advanced, but also more accurate and generally
neat to know. Need more?

I'm C++/Java/JavaScript programmer (or at least like to think to be
such :)

But for the current project I need to program on VBA for Microsoft
Access in a mixed environment. It is so mixed that it has to cover
Office 97 - Office 2003 so it's a "mix" of a kind you see at the next
morning after a joyful party :-( :)
From my side the only control I have is to make sure that all SP's for
relevant packages are installed plus IE6 on each machine.

Now the issue itself: it is a project for a dictionary making group.
They use a TeX-like markup system to denote stresses and extra phonetic
info inside words. Say like
ps{eu}do-scient<i>fic
to denote secondary stress in the first syllable and the primary stress
in the second one.
They were asking for some graphics interface in addition to the markup
way, so they could left-click/right-click on the letters to set some
basic signs.

That seems nearly impossible in Office as the graphics context control
seems poor to the level of no presence (at least after JavaScript/DOM
and Java Graphics/FontMetrics).

w/o it I cannot link properly click coords - clicked characters -
character coors so to place extra symbols properly around.
So far the best what I came with is a row of labels (32 as it's the max
length for entry) with one letter in each label and a set of hidden
labels I reveal and place properly upon clicks.
Seems utterly ugly (programmatically) but a the time of NN3/IE3 I
already was forced to do things like that.

Using TextBox as a Label is an idea I did not think about, thanks and
will give it a try.
All other numerous words above are in case if someone has a better idea
or hint.
Ideally (as I see it) it would be some scriptable control a la
Microsoft Equation to insert it into form, but the provided funding
doesn't go far enough to program it from the scratch.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top