Solved

ComboBox Excel 2003 Get value

Posted on 2010-08-29
5
698 Views
Last Modified: 2012-06-22
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
Comment
Question by:sporenza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 29

Expert Comment

by:nffvrxqgrcfqvvc
ID: 33552613
Have you tried .Text?
Private Sub Combo1_Click()
  Debug.Print Combo1.Text
End Sub

Open in new window

0
 

Author Comment

by:sporenza
ID: 33553506
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
 
LVL 29

Expert Comment

by:nffvrxqgrcfqvvc
ID: 33553523
Did you try with the name of your ComboBox object?
Msgbox ComboBox1.Text

Open in new window

0
 

Author Comment

by:sporenza
ID: 33553571
This worked!!!

How do I set this to a varriable??

I want something like, if possible:

   Dim filename As String
   filename = ComboBox1.Text
0
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 500 total points
ID: 33553578
You have already answered this in your own example above ^^  :)
Dim filename As String
filename = ComboBox1.Text

Open in new window

0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question