Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 17th, 2003, 09:33 PM
Registered User
Join Date: Jul 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to KathleenS
Default Read drop-down list validated in Excel


I am working with an Excel file where one of the columns
is set up as a drop-down list validated by data from a
second worksheet. I am using VB (.NET) to read the data
in the Excel file, using code similar to:

    Dim xlApp as New Excel.Application()
    Dim xlWB as Excel.Workbook
    Dim str1, str2 as String

    xlWB = xlApp.Workbooks.Open(filename)
    str1 = xlWB.Worksheets(1).Cells(1,1).Text
    str2 = xlWB.Worksheets(1).Cells(1,2).Text

Cell 1,1 (A1) is not validated, and the program pulls the
value just fine. Cell 1,2 (B1) is validated, and after
the above command is executed str2 is set to "" even
though an item from the drop-down list has been selected
in the cell.

How do I access the value displayed in that cell?

Thanks in advance

Reply With Quote
  #2 (permalink)  
Old August 10th, 2003, 08:41 AM
Authorized User
Join Date: Aug 2003
Location: Penn Yan, New York, USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts

As an alternative you might try

    str2 = xlWB.Worksheets(1).Cells(1,2).Value

rather than

    str2 = xlWB.Worksheets(1).Cells(1,2).Text

Just a thought.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why Shipping address is not validated? webeye BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 September 18th, 2008 10:31 AM
drop down list values based on another drop down noor ASP.NET 1.0 and 1.1 Basics 3 July 5th, 2005 09:57 AM
Trouble putting data into Excel Drop Down List Arsi C# 2 October 26th, 2004 11:47 AM
Drop Down List mrideout BOOK: Beginning ASP.NET 1.0 8 September 16th, 2004 07:11 AM

All times are GMT -4. The time now is 04:22 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.