Programming for Listboxes in Forms

R

Rich W.

I need to use a Listbox Control from the Forms toolbar. (I cannot use ActiveX
controls due to the fact this spreadsheet needs to work on Macs.)

I'm fairly new to VBA, but I can manage ActiveX controls. My problem is how
to program for a ListBox form control.

I haven't been able to find examples and/or references for working with
these controls. Can anyone point me to a decent reference? (Help hasn't been
help - but then maybe I'm not using the right vocab.) Ugh.

Thanks in advance . . .

Rich
 
D

Dick Kusleika

I need to use a Listbox Control from the Forms toolbar. (I cannot use ActiveX
controls due to the fact this spreadsheet needs to work on Macs.)

I'm fairly new to VBA, but I can manage ActiveX controls. My problem is how
to program for a ListBox form control.

I haven't been able to find examples and/or references for working with
these controls. Can anyone point me to a decent reference? (Help hasn't been
help - but then maybe I'm not using the right vocab.) Ugh.

I don't know of a decent reference. In the VBE, press F2 to bring up the
object browser. Right click and select "Show Hidden Members". Then search
for ListBox and you can review the properties and methods.


Sheet1.Listboxes(1).ListFillRange = "$A$1:$A$10"

Sheet1.Listboxes(1).LinkedCell = "$C$5"
 
J

Jim Cone

Rich,
I don't use Apple computers, so be advised...

You are looking the ".AddFormControl" method for a shape.
Also, ".TextFrame.Characters.Text" = "Attractive Name" will put a caption
on the shape, if it allows captions.
--
Jim Cone
Portland, Oregon USA



"Rich W." <[email protected]>
wrote in message
I need to use a Listbox Control from the Forms toolbar. (I cannot use ActiveX
controls due to the fact this spreadsheet needs to work on Macs.)

I'm fairly new to VBA, but I can manage ActiveX controls. My problem is how
to program for a ListBox form control.

I haven't been able to find examples and/or references for working with
these controls. Can anyone point me to a decent reference? (Help hasn't been
help - but then maybe I'm not using the right vocab.) Ugh.
Thanks in advance . . .
Rich
 
J

JLGWhiz

I have problems with the old Forms Toolbar controls and have to research
every time I work with one in VBA. I usually just set them up manually then
limit my VBA to using them, and even that is sometimes bothersome.If you find
a good reference somewhere, post back and let us all know.
 
D

Dave Peterson

You may get more useful responses if you're more specific with what you want to
do with those listboxes?

Retrieve values from them??? You'll need code if you allow multiple
selections. But you can use a linkedcell if you only allow a single item to be
selected.

As a developer/user, I think most of the listboxes that I've used don't have
code applied to them. But I'll have a button (also from the forms toolbar) that
will process the choices made in the listbox. (I'm afraid that if I have code
assigned to the _click event, then I (the user) will click on the wrong item.)

You could search the microsoft newsgroups looking for "as listbox" (with the
quotes). I'm sure that you'll find lots of sample code where posters have
declared as variable as a listbox.
 
H

Harald Staff

I've kept a copy of my Excel 5 help file, it's named VBA_XL.HLP and dated
1994. It is of tremendous help (ok I know, help files are supposed to be)
when programming for Forms controls and Excel5 dialogs.
I can't find a download location with google right now, but it's got to be
out there somewhere.

Best wishes Harald
 
J

Jim Cone

Harald,
Isn't using a help file cheating? <g>
--
Jim Cone
Portland, Oregon USA



"Harald Staff"
<[email protected]>
wrote in message
I've kept a copy of my Excel 5 help file, it's named VBA_XL.HLP and dated
1994. It is of tremendous help (ok I know, help files are supposed to be)
when programming for Forms controls and Excel5 dialogs.
I can't find a download location with google right now, but it's got to be
out there somewhere.

Best wishes Harald
 
H

Harald Staff

LOL.
CHM files and MSDN is cheating. Ancient HLP from way back just adds a touch
of class. They won't even run on Vista without additional software.

Best wishes Harald
 
R

Rich W.

Thanks Dick . . . I didn't know about "Show Hidden" . . . your reply was
worth it just for that!.

Rich
 
R

Rich W.

Thanks Harald . . .

I did a search on google and couldn't find it (Maybe I wasn't patient
enough!) . . . but we did have an old copy laying around. . . .

Thanks again,

Rich
 

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