Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 703
  • Last Modified:

ComboBox Excel 2003 Get value

Hi All,

Having a hard time with what I thought was easy.

I have a visual basic script in Excel 2003.  I have a combobx named "ComboBox1".  How do i print out the current value in combobox???

I have tried just
MsgBox (ComboBox1.Value)

to print out the value and this does not work.
0
sporenza
Asked:
sporenza
  • 3
  • 2
1 Solution
 
nffvrxqgrcfqvvcCommented:
Have you tried .Text?
Private Sub Combo1_Click()
  Debug.Print Combo1.Text
End Sub

Open in new window

0
 
sporenzaAuthor Commented:
Hi eql1044,

If I run _ClicK(), nothing happens when I change the drop down.

If I run:
Private Sub ComboBox1_Change()
  Debug.Print Combo1.Text
End Sub


I get Run-time error '424'

Thnaks!
0
 
nffvrxqgrcfqvvcCommented:
Did you try with the name of your ComboBox object?
Msgbox ComboBox1.Text

Open in new window

0
 
sporenzaAuthor Commented:
This worked!!!

How do I set this to a varriable??

I want something like, if possible:

   Dim filename As String
   filename = ComboBox1.Text
0
 
nffvrxqgrcfqvvcCommented:
You have already answered this in your own example above ^^  :)
Dim filename As String
filename = ComboBox1.Text

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now