Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default reset combobox to blank

this is in a worksheet_open sub. the combobox is the only activex
control on the worksheet. what am i doing wrong? i tried "value" but
that didn't work. but neither is listindex. i originally had it all
in one line but when that didn't work i thought it might need a "with"
statement (ThisWorkbook.Sheets("Income").OLEObjects
("cmbCounty").ListIndex = 0 'Value = "")
thanks a lot for any advice.

With ThisWorkbook.Sheets("Income")
.OLEObjects("cmbCounty").ListIndex = 0 'Value = ""
End With

:)
susan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default reset combobox to blank

Try setting the ListIndex to -1 (minus one) instead of 0.

--
Rick (MVP - Excel)


"Susan" wrote in message
...
this is in a worksheet_open sub. the combobox is the only activex
control on the worksheet. what am i doing wrong? i tried "value" but
that didn't work. but neither is listindex. i originally had it all
in one line but when that didn't work i thought it might need a "with"
statement (ThisWorkbook.Sheets("Income").OLEObjects
("cmbCounty").ListIndex = 0 'Value = "")
thanks a lot for any advice.

With ThisWorkbook.Sheets("Income")
.OLEObjects("cmbCounty").ListIndex = 0 'Value = ""
End With

:)
susan


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default reset combobox to blank

hmmmm. didn't work.

tried msgboxes before & after to see the value and neither mgbox got
triggered, for some odd reason.
the code before & below this section was accessed & performed.
can't set a breakpoint & step through it because when i save & close
the workbook, the breakpoint gets cleared. :(

MsgBox ThisWorkbook.Sheets("Income").OLEObjects("cmbCount y").Text
With ThisWorkbook.Sheets("Income")
.OLEObjects("cmbCounty").ListIndex = -1
End With
MsgBox ThisWorkbook.Sheets("Income").OLEObjects("cmbCount y").Text

any other ideas? i'm thinking i'm going to have to copy this section
of code to another module & play with it outside of the workbook_open
sub to get it working, then move it back into the workbook_open sub.
a thought - can oleobjects be accessed from a general module??? or
perhaps can they only be accessed from sheet code?
susan



On Nov 16, 11:41*am, "Rick Rothstein"
wrote:
Try setting the ListIndex to -1 (minus one) instead of 0.

--
Rick (MVP - Excel)

"Susan" wrote in message

...



this is in a worksheet_open sub. *the combobox is the only activex
control on the worksheet. *what am i doing wrong? *i tried "value" but
that didn't work. *but neither is listindex. *i originally had it all
in one line but when that didn't work i thought it might need a "with"
statement (ThisWorkbook.Sheets("Income").OLEObjects
("cmbCounty").ListIndex = 0 * 'Value = "")
thanks a lot for any advice.


* *With ThisWorkbook.Sheets("Income")
* * *.OLEObjects("cmbCounty").ListIndex = 0 * 'Value = ""
* *End With


:)
susan- Hide quoted text -


- Show quoted text -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default reset combobox to blank

i got it

ThisWorkbook.Sheets("Income").cmbCounty.ListIndex = -1

don't know why it doesn't want the "oleobjects" in there, because i
definitely used the activex control, but it works this way.
thanks for all your help!
susan


On Nov 16, 12:24*pm, Susan wrote:
hmmmm. *didn't work.

tried msgboxes before & after to see the value and neither mgbox got
triggered, for some odd reason.
the code before & below this section was accessed & performed.
can't set a breakpoint & step through it because when i save & close
the workbook, the breakpoint gets cleared. *:(

MsgBox ThisWorkbook.Sheets("Income").OLEObjects("cmbCount y").Text
* * With ThisWorkbook.Sheets("Income")
* * * .OLEObjects("cmbCounty").ListIndex = -1
* * End With
MsgBox ThisWorkbook.Sheets("Income").OLEObjects("cmbCount y").Text

any other ideas? *i'm thinking i'm going to have to copy this section
of code to another module & play with it outside of the workbook_open
sub to get it working, then move it back into the workbook_open sub.
a thought - can oleobjects be accessed from a general module??? *or
perhaps can they only be accessed from sheet code?
susan

On Nov 16, 11:41*am, "Rick Rothstein"



wrote:
Try setting the ListIndex to -1 (minus one) instead of 0.


--
Rick (MVP - Excel)


"Susan" wrote in message


....


this is in a worksheet_open sub. *the combobox is the only activex
control on the worksheet. *what am i doing wrong? *i tried "value" but
that didn't work. *but neither is listindex. *i originally had it all
in one line but when that didn't work i thought it might need a "with"
statement (ThisWorkbook.Sheets("Income").OLEObjects
("cmbCounty").ListIndex = 0 * 'Value = "")
thanks a lot for any advice.


* *With ThisWorkbook.Sheets("Income")
* * *.OLEObjects("cmbCounty").ListIndex = 0 * 'Value = ""
* *End With


:)
susan- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default reset combobox to blank

You can do it that way but it's not always a good idea to hardcode objects
as you are. You almost had it right before, just missing '.Object'

With ThisWorkbook.Sheets("Income")
.OLEObjects("cmbCounty").Object.ListIndex = -1
End With

Regards,
Peter T



"Susan" wrote in message
...
i got it

ThisWorkbook.Sheets("Income").cmbCounty.ListIndex = -1

don't know why it doesn't want the "oleobjects" in there, because i
definitely used the activex control, but it works this way.
thanks for all your help!
susan


On Nov 16, 12:24 pm, Susan wrote:
hmmmm. didn't work.

tried msgboxes before & after to see the value and neither mgbox got
triggered, for some odd reason.
the code before & below this section was accessed & performed.
can't set a breakpoint & step through it because when i save & close
the workbook, the breakpoint gets cleared. :(

MsgBox ThisWorkbook.Sheets("Income").OLEObjects("cmbCount y").Text
With ThisWorkbook.Sheets("Income")
.OLEObjects("cmbCounty").ListIndex = -1
End With
MsgBox ThisWorkbook.Sheets("Income").OLEObjects("cmbCount y").Text

any other ideas? i'm thinking i'm going to have to copy this section
of code to another module & play with it outside of the workbook_open
sub to get it working, then move it back into the workbook_open sub.
a thought - can oleobjects be accessed from a general module??? or
perhaps can they only be accessed from sheet code?
susan

On Nov 16, 11:41 am, "Rick Rothstein"



wrote:
Try setting the ListIndex to -1 (minus one) instead of 0.


--
Rick (MVP - Excel)


"Susan" wrote in message


...


this is in a worksheet_open sub. the combobox is the only activex
control on the worksheet. what am i doing wrong? i tried "value" but
that didn't work. but neither is listindex. i originally had it all
in one line but when that didn't work i thought it might need a "with"
statement (ThisWorkbook.Sheets("Income").OLEObjects
("cmbCounty").ListIndex = 0 'Value = "")
thanks a lot for any advice.


With ThisWorkbook.Sheets("Income")
.OLEObjects("cmbCounty").ListIndex = 0 'Value = ""
End With


:)
susan- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default reset combobox to blank

ok, i'll fix it. thanks peter.
susan


On Nov 16, 2:51*pm, "Peter T" <peter_t@discussions wrote:
You can do it that way but it's not always a good idea to hardcode objects
as you are. You almost had it right before, just missing '.Object'

With ThisWorkbook.Sheets("Income")
* .OLEObjects("cmbCounty").Object.ListIndex = -1
End With

Regards,
Peter T

"Susan" wrote in message

...
i got it

ThisWorkbook.Sheets("Income").cmbCounty.ListIndex = -1

don't know why it doesn't want the "oleobjects" in there, because i
definitely used the activex control, but it works this way.
thanks for all your help!
susan

On Nov 16, 12:24 pm, Susan wrote:



hmmmm. didn't work.


tried msgboxes before & after to see the value and neither mgbox got
triggered, for some odd reason.
the code before & below this section was accessed & performed.
can't set a breakpoint & step through it because when i save & close
the workbook, the breakpoint gets cleared. :(


MsgBox ThisWorkbook.Sheets("Income").OLEObjects("cmbCount y").Text
With ThisWorkbook.Sheets("Income")
.OLEObjects("cmbCounty").ListIndex = -1
End With
MsgBox ThisWorkbook.Sheets("Income").OLEObjects("cmbCount y").Text


any other ideas? i'm thinking i'm going to have to copy this section
of code to another module & play with it outside of the workbook_open
sub to get it working, then move it back into the workbook_open sub.
a thought - can oleobjects be accessed from a general module??? or
perhaps can they only be accessed from sheet code?
susan


On Nov 16, 11:41 am, "Rick Rothstein"


wrote:
Try setting the ListIndex to -1 (minus one) instead of 0.


--
Rick (MVP - Excel)


"Susan" wrote in message


....


this is in a worksheet_open sub. the combobox is the only activex
control on the worksheet. what am i doing wrong? i tried "value" but
that didn't work. but neither is listindex. i originally had it all
in one line but when that didn't work i thought it might need a "with"
statement (ThisWorkbook.Sheets("Income").OLEObjects
("cmbCounty").ListIndex = 0 'Value = "")
thanks a lot for any advice.


With ThisWorkbook.Sheets("Income")
.OLEObjects("cmbCounty").ListIndex = 0 'Value = ""
End With


:)
susan- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default reset combobox to blank

Hi Susan

The default listindex for for ComboBox, DirListBox, and DriveListBox
controls is -1 which indicates that no item is currently selected .

If this post helps click Yes
---------------
Jacob Skaria


"Susan" wrote:

this is in a worksheet_open sub. the combobox is the only activex
control on the worksheet. what am i doing wrong? i tried "value" but
that didn't work. but neither is listindex. i originally had it all
in one line but when that didn't work i thought it might need a "with"
statement (ThisWorkbook.Sheets("Income").OLEObjects
("cmbCounty").ListIndex = 0 'Value = "")
thanks a lot for any advice.

With ThisWorkbook.Sheets("Income")
.OLEObjects("cmbCounty").ListIndex = 0 'Value = ""
End With

:)
susan

.

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
combobox value blank ranswert Excel Programming 9 March 17th 08 04:38 PM
Reset values in a combobox Albert Excel Programming 0 January 21st 08 02:00 PM
Combobox drops down blank row Albert Excel Programming 5 January 18th 08 04:17 PM
reset a combobox girlie New Users to Excel 1 September 26th 06 10:02 AM
Remove blank rows from combobox Steph[_3_] Excel Programming 1 June 25th 04 05:37 PM


All times are GMT +1. The time now is 10:05 AM.

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

About Us

"It's about Microsoft Excel"