Well I don't know what it was, but I still couldn't get it to work in my workbook. It worked in a new XL07 workbook, but not the one I was working on.
What I did was export all the modules, form and code to a new workbook, testing the functionality between each import.
And it works in the new workbook that contains all of the code and copied sheets.
I notice that there are two dll libraries that I didn't reference...
User Profile
Collapse
-
Ahh, I didn't even see the attachment, and yes it is working!
I see that you used the ActiveX listbox, and not the Form listbox. The ActiveX listbox methods were available in the code-behind for the sheet, but for me I was unable to access it in a module.
I have a few things to work backwards from to get things working properly now.
Thanks ggeu, you've saved the rest of my hair, as I didn't get a chance to...Leave a comment:
-
Yes, but unfortunately not in the version I'm using (2007). Maybe it's a library I don't have installed (or the order that the libraries are listed)? Or just reduced functionality or transversed into something else? Or maybe the way I dim'd the object as shape? Not sure, but it's driving me nuts! And thanks for all your help recently with everything, much appreciated.Leave a comment:
-
Excel 2007 - Listbox "Selected()" property fails
I am having a problem trying to select items from a listbox that is drawn on my worksheet. I have no problem adding items, or removing items.... only when I try to identify the items that are selected.
There is no ".Selected" in the intellisense for either the object directly, or the object.ControlF ormat. When I execute this code, Excel fails with the error message: "Runtime Error 438. Object doesn't support this... -
That is a great solution which I can use for other situations that I'm encountering, thank you!
I thought of another which also works:
For i = 1 to n
strCode = "lblIndicat or" & CStr(i)
frmStatus.Contr ols(strCode).Ba ckColor = vbGreen
Next iLeave a comment:
-
So how would I use this in my example? I'm confused.
I don't know if "Evaluate" or "Eval" are the right function for what I am trying to do. I'm trying to execute a string as a line of code.
e.g.
I have n labels called: lblText1, lblText2, ... lblTextn
I wish to programmaticall y change the backcolor of all with a For loop.
How do I do it?
Dim strCode as String
...Leave a comment:
-
How to execute a string VBA for Excel
I am using VBA for Excel, and am trying to execute the following:
Dim strElement as String
strElement = "frmLoad.lblInd icator" & 1 & ".BackColor = vbGreen"
Evaluate(strEle ment)
---------
The "Evaluate() " function doesn't work, and when I tried "Eval()" it returned an error.
No activity results to display
Show More
Leave a comment: