LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Referring to OLEObjects (combobox's on worksheet)

Sorry Tom, Got it sorted by changing to:

Set MyBox = Me.OLEObjects(sBoxName).Object

Not exactly sure why though?

"Ian Chappel" wrote in message
...
Thanks Tom

Actually, I've got a very similar but slightly different probelm now. What
can I change here to refer to a ComboBox from a string I have generated,
e.g.:

dim sBoxName as string, iBoxNum as integer

sBoxName = "ComboBox" & cStr(iBoxNum)
Set MyBox = Me.OLEObjects(sBoxName)

"Tom Ogilvy" wrote in message
...


For iX = 9 To 20
sBoxName = "ComboBox" & CStr(iX)
Me.OLEObjects(sBoxName).Object.Listindex = -1
Next

--
Regards,
Tom Ogilvy

Ian Chappel wrote in message
...
Apologies - I am actually trying to clear the box(s).

"Tom Ogilvy" wrote in message
...
What are you trying to do

Me.OleObjects(sBoxName) = "" is unclear. Are you trying to rename

the
box?


Dim iX As Integer, sBoxName As String

For iX = 9To 20
sBoxName = "ComboBox" & CStr(iX)
Me.OLEObjects(sBoxName).Object.Value = "ABCD"
Next

would set the value of the combobox.

--
Regards,
Tom Ogilvy

"Ian Chappel" wrote in message
...
How can I refer to, for instance, ComboBox9 to ComboBox20?

I've tried the following but OLEObjects doesn't seem to work , but

if
I
try
to retrieve the object's name, no problem. I have a feeling the
OLEObjects
bit is read-only, but I'm not sure how to work round it, without

naming
each
box.

Dim iX As Integer, sBoxName As String

For iX = 9To 20
sBoxName = "ComboBox" & CStr(iX)
Me.OLEObjects(sBoxName) = ""
Next

The code is located in a Worksheet.
















 
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
Referring to cells on a different worksheet GARY Excel Discussion (Misc queries) 3 November 10th 09 12:24 AM
formula referring to a worksheet Nicawette Excel Worksheet Functions 4 August 6th 09 09:54 AM
referring a worksheet lazmanyak Excel Worksheet Functions 1 July 23rd 05 02:55 PM
referring to other worksheet Geetu M Excel Worksheet Functions 2 March 29th 05 09:37 PM
checking for errors in combobox's Bob C[_2_] Excel Programming 1 September 4th 03 09:03 PM


All times are GMT +1. The time now is 03:31 PM.

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"