Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Accessing the values of form controls on worksheets in Excel 2000

Hello,

I have inherited a set of worksheets with about 40 drop down form
controls on each worksheet.
I need to programatically extract the values from the drop down boxes
so that they can be loaded into a database.

Unfortunately the creater didn't setup the cell link (Format
Control-Control-Cell link) and it doesn't look like it will be
practical to update all 150 instances of the spreadsheet with the
correct cell links..... :(

I have tried to access the drop down boxes through the OLEObjects
collection but a count says that there are no OLEobjects on the
worksheet.
As far as I can tell this is because they are form controls and not
controls selected from the control toolbox.
'Debug.Print Worksheets("General details").OLEObjects.Count

The drop down boxes are in the shapes collection but I can't do any
kind of casting so that I can get them into a control object (or
something similar) so that I can get the value.

I am using Excel 2000 SR-1.

Any help would be appreciated as my manager is keen to find a solution
quickly.

Regards,

Mark



------------------------------------------------
Message posted from http://www.ExcelTip.com/

-- View and post Excel related usenet messages directly from http://www.ExcelTip.com/forum
-- Hundreds of free MS Excel tips, tricks and solutions at http://www.ExcelTip.com/
------------------------------------------------
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Accessing the values of form controls on worksheets in Excel 2000

They are in the dropdowns collection

dim drp as DropDown
for each drp in activesheet.DropDowns
drp.LinkedCell = drp.TopLeftCell.Address(External:=True)
Next


--
Regards,
Tom Ogilvy


"robbinma" wrote in message
...
Hello,

I have inherited a set of worksheets with about 40 drop down form
controls on each worksheet.
I need to programatically extract the values from the drop down boxes
so that they can be loaded into a database.

Unfortunately the creater didn't setup the cell link (Format
Control-Control-Cell link) and it doesn't look like it will be
practical to update all 150 instances of the spreadsheet with the
correct cell links..... :(

I have tried to access the drop down boxes through the OLEObjects
collection but a count says that there are no OLEobjects on the
worksheet.
As far as I can tell this is because they are form controls and not
controls selected from the control toolbox.
'Debug.Print Worksheets("General details").OLEObjects.Count

The drop down boxes are in the shapes collection but I can't do any
kind of casting so that I can get them into a control object (or
something similar) so that I can get the value.

I am using Excel 2000 SR-1.

Any help would be appreciated as my manager is keen to find a solution
quickly.

Regards,

Mark



------------------------------------------------
Message posted from http://www.ExcelTip.com/

-- View and post Excel related usenet messages directly from

http://www.ExcelTip.com/forum
-- Hundreds of free MS Excel tips, tricks and solutions at

http://www.ExcelTip.com/
------------------------------------------------



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Accessing the values of form controls on worksheets in Excel 2000

Thanks Tom.
I should have realised about the sting/range difference.
That now works great.:D

Cheers,

Mark

Tom Ogilvy wrote:
[b]drp.ListfillRange is a string, not a range. You need to do

Range(drp.ListFillRange)

From the immediate window:

? drp.Value
7
? drp.ListfillRange
$A$1:$A$25
? application.Index(Range(drp.ListfillRange),drp.val ue,1,1)
Item7

--
Regards,
Tom Ogilvy

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I split form controls in a sheet in excel? Desperateticha Excel Discussion (Misc queries) 1 November 9th 07 01:57 PM
Form controls in Excel 07 New to Excel 07 Excel Discussion (Misc queries) 1 July 30th 07 04:43 PM
Interaction of form controls and pictures in Excel 2007 keithrmanning Excel Worksheet Functions 7 November 9th 06 03:39 PM
ActiveX Controls vs Form Controls Alex Excel Discussion (Misc queries) 1 January 11th 06 08:46 AM
Accessing ActiveX Controls using VBA - can't use Control.Name to access. Rob Bovey Excel Programming 2 July 30th 03 09:11 AM


All times are GMT +1. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"