View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Roger PB Roger PB is offline
external usenet poster
 
Posts: 6
Default Erratic Behaviour of Buttons

I have been trying for several days to attach some buttons to a worksheet,
to set the properties caption and colour, and to assign a macro to each of
them.

Somehow I have actually achieved this with some of them, but I do not know
how. When I right click a button (in design mode) I get different messages
for each.

For instance, one button has the caption "Update" and when I right click
this I get a menu:
Cut, Copy, .. . Edit Text, Grouping, Order, Assign Macro, Format Control.
Right clicking this a second time seems to turn off design mode and "Assign
Macro" disappears from the list.
This does not toggle with the first list on reclicking. Design mode has to
be turned on again.

But another button "Find Unique Values", when I right click it, produces
Cut, Copy,....Properties, View Code, Command Button Object, Grouping, Order,
Format Control.

Note that the options "Properties" and "View Code" are not available for the
first button, and that "Assign Macro" is not available for the second
button.

The behaviour of the "Find Unique Values" button follows that described
(for commandbuttons) in Richard Shepherd's "Excel VBA Macro Programming".
When not in design mode, the button does not react to a right click; a macro
can be assigned by inserting it in Private Sub CommandButton1_Click(). In
the properties menu I find "CommandButton1 Command Button", and "Sheet6
Worksheet", but none of my other buttons are listed.

So it seems that the "Update" button, and other like it, cannot be
commandbuttons. The behaviour of the "Update" button does not follow
Shepherd. It responds to a right click when not in design mode, and offers
the option "Assign Macro". This is very convenient, but on the other hand I
cannot change the properties.So if such buttons are not commandbuttons, what
are they? If I right click "Update" and then call up "Properties" by right
clicking the sheet tab, I get properties for Sheet6 and the CommandButton1
only.

To confuse the issue further, the "Find Unique Values" button, on right
clicking, sometimes comes up with a different menu: "Move Here, Copy Here,
Cancel". Click "Cancel" and reclick, and the same menu appears. Click
somewhere outside the menu and reclick and the "Cut, Copy, Properties..."
options return. I have not fathomed how I can deliberately get the "Move
Here..." menu to pop up.

To sum up,
(1) can someone tell me how to change to properties of buttons to which I
can assign a macro,
and what kind of buttons are these, if not commandbuttons? What must I click
in the toolbox to get such a button?

(2) Alternatively, can one assign a macro to a commandbutton without having
to paste it into the code window?

(3) What causes the "Move/Copy Here" window to appear ? (And what is meant
by "Here"?)

Thanks in advance for any help!

RogerPB