ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error Help ClearContents (https://www.excelbanter.com/excel-programming/408775-error-help-clearcontents.html)

millwalll

Error Help ClearContents
 
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



NateBuckley

Error Help ClearContents
 
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 = ""

"millwalll" wrote:

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



Tom Hutchins

Error Help ClearContents
 
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

"millwalll" wrote:

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




All times are GMT +1. The time now is 12:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com