Error Help ClearContents

  • Thread starter Thread starter millwalll
  • Start date Start date
M

millwalll

Hi I am geting a error but not too sure why this line of code ,


Software_form.txtSoftware1.Value = ClearContents

compile error
variable not defined

I understand the error but I thought clearContents was build in variable the
code is in form

any help many thanks :P
 
If it's a list box then you can do the following

lstBoxTest.Clear

but when you use the = sign you are trying to assign something to the
object, so even if the textBox (I'm guessing that's what it is) did have a
clear function it would be used by calling a method within the object like so

Software_form.txtSoftware1.Clear but that won't work.
Just do

Software_form.txtSoftware1.Value = ""
 
When I check the VBA help (Excel 2003), I only see a ClearContents method,
not a "built-in variable". The ClearContents method only applies to ranges
and charts. I suggest you set the value of your textbox to vbNullString to
clear it:

Software_form.txtSoftware1.Value = vbNullString

Hope this helps,

Hutch
 
Thanks I will try that but what I dont get is it was working before !!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top