textbox trouble
Hi Craig,
If the textboxes are from the control Toolbox, try something like:
..===========================
Sub TestIt()
Dim VarTest As Long
Dim iBox As OLEObject
'code to assign value to VarTest variable, e.g.:
VarTest = 2
Set iBox = Sheets("Sheet1").OLEObjects("textbox" & VarTest)
With iBox.Object
.Text = "Test"
.Enabled = False
End With
End Sub
'<<===========================
---
Regards,
Norman
"Craig" wrote in message
news:ru9Ue.160385$Hk.63792@pd7tw1no...
Hello agian!
I'm trying to set a textbox for use later in the code.
Dim iBox as Textbox
if varTest = 1 then
Set iBox = Sheet1.textbox1
elseif varTest = 2 then
Set iBox = Sheet1.textbox2
elseif varTest = 3 then
Set iBox = Sheet1.textbox3
end if
with iBox
.text = "Test"
.enabled=False
etc...
end with
It errors during the Set iBox= line of codes, what am I doing wrong?
Thanks
Craig
|