Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Capture Current Selection in a Combo Box

Hi,

I'm trying capture the current selection from a combo box (from the
Control Toolbox, not Forms). Example:

MySelection = ComboBox1.Value

I don't know how to refer to the combo box. I'm getting a compile
error (variable not defined). Please note, I am not working in the
private subroutine. I am working outside of the combo box code in a
general module.

TIA
Randy Eastland
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Capture Current Selection in a Combo Box

If you're working on a module, you need to refer to the combobox in its
container (form). So if your form is called UserForm1 you would have
something like this:

MySelection = UserForm1.ComboBox1.Value

Also if you're using Option Explicit at the top of your code, you need to
declare the dimension of MySelection.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Capture Current Selection in a Combo Box

Assuming you meant a worksheet based ComboBox from the
Control Toolbox toolbar:

Sub GetComboValue()
Dim txt As String
txt = ActiveSheet.OLEObjects("ComboBox1").Object.Value
MsgBox txt
End Sub

Regards,
Greg

-----Original Message-----
Hi,

I'm trying capture the current selection from a combo box

(from the
Control Toolbox, not Forms). Example:

MySelection = ComboBox1.Value

I don't know how to refer to the combo box. I'm getting a

compile
error (variable not defined). Please note, I am not

working in the
private subroutine. I am working outside of the combo

box code in a
general module.

TIA
Randy Eastland
.

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
Excel screen capture to capture cells and row and column headings jayray Excel Discussion (Misc queries) 5 November 2nd 07 11:01 PM
In a range of months can I capture the most current month entry? Karlene Excel Discussion (Misc queries) 4 August 15th 07 05:55 PM
capture text typed in Combo Box seeker Excel Programming 0 May 4th 04 06:14 PM
Update on Current Selection Randal W. Hozeski Excel Programming 0 December 29th 03 04:37 PM
Capture listbox selection to a cell in a different sheet Marcie Excel Programming 2 September 19th 03 12:15 PM


All times are GMT +1. The time now is 04:08 AM.

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"