View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Fendic[_13_] Fendic[_13_] is offline
external usenet poster
 
Posts: 1
Default how to use object variable to change the property of a


Hi all,

I'd like to like to assign a number of Labels into an array, so that
can use loop to change the caption of each Label. I tried testing b
using object variable as follows:

Dim testLabel As Label
testLabel = myLabel

myLabel is a Label i created in a form. but if i run the code, an erro
would show that ''object variable or 'with' block variable is no
defined'', which i don't understand, cos apparently testLabel i
clearly defined.

However, if i change it to be:

Dim testLabel
testLabel = myLabel

it works, but testLabel is actually a string, in stead of a label, thu
i'll not be able to change the caption of it.

can anyone help please. it sounds easy, but i've been struggling fo
days, and just can't get the syntax right. thanks

All the best,
Fendi

--
Fendi
-----------------------------------------------------------------------
Fendic's Profile: http://www.excelforum.com/member.php...fo&userid=2395
View this thread: http://www.excelforum.com/showthread.php?threadid=38998