Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am stymied trying to figure the code that sets the focus of an
ActiveX ListBox to the first name appearing in the ListBox. The ListBox is on Sheet1. I tried this code but get the error message "Compile Error Sub or Function not defined" I am using Excel 2007 Private Sub Workbook_Open() Application.ScreenUpdating = False Sheets("Sheet1").Select OLEObject("ListBox1").Value = "ABC" Application.ScreenUpdating = True End Sub Can anyone help me correct this code so when the workbook opens - it displays the right sheet and the ListBox shows the focus on the first name? Thank you, Rob |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi Rob,
With Sheets("Sheet1").ListBox1 ..ListIndex = 0 End With -- isabelle Le 2012-06-21 13:22, Rob Flott a écrit : I am stymied trying to figure the code that sets the focus of an ActiveX ListBox to the first name appearing in the ListBox. The ListBox is on Sheet1. I tried this code but get the error message "Compile Error Sub or Function not defined" I am using Excel 2007 Private Sub Workbook_Open() Application.ScreenUpdating = False Sheets("Sheet1").Select OLEObject("ListBox1").Value = "ABC" Application.ScreenUpdating = True End Sub Can anyone help me correct this code so when the workbook opens - it displays the right sheet and the ListBox shows the focus on the first name? Thank you, Rob |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Isabelle, thank you very much...this works great... |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rob, you're welcome! ..feedback is always appreciated, thank to you!
-- isabelle Le 2012-06-21 18:08, Rob Flott a écrit : Isabelle, thank you very much...this works great... |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jun 21, 6:07*pm, isabelle wrote:
Rob, you're welcome! ..feedback is always appreciated, thank to you! -- isabelle Le 2012-06-21 18:08, Rob Flott a écrit : Isabelle, thank you very much...this works great...- Hide quoted text - - Show quoted text - Hi Isabelle....I spoke to soon...when I run the macro it works fine...but when I 'call' the macro in my 'Workbook_Open()' sub I get 'Run-Time error '438' Object doesn't support this property or method'. Ironically, when I click 'End' on this error message it runs the macro without any problems. Any ideas as to why this happens? Thanks Isabelle |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi Rob,
i tried it with the Workbook_Open event and i have no error, here is my test file: http://cjoint.com/?BFwruPnWL1q can you try it? -- isabelle Le 2012-06-22 10:56, Rob Flott a écrit : On Jun 21, 6:07 pm, wrote: Rob, you're welcome! ..feedback is always appreciated, thank to you! -- isabelle Le 2012-06-21 18:08, Rob Flott a écrit : Isabelle, thank you very much...this works great...- Hide quoted text - - Show quoted text - Hi Isabelle....I spoke to soon...when I run the macro it works fine...but when I 'call' the macro in my 'Workbook_Open()' sub I get 'Run-Time error '438' Object doesn't support this property or method'. Ironically, when I click 'End' on this error message it runs the macro without any problems. Any ideas as to why this happens? Thanks Isabelle |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ListBox Property where 'focus' triggers selection | Excel Programming | |||
ActiveX Combo Box Focus | Excel Programming | |||
Listbox Item Focus | Excel Programming | |||
ActiveX comboboxes on worksheet (lost focus problems) | Excel Programming | |||
removing selection focus in listbox | Excel Programming |