Link to home
Start Free TrialLog in
Avatar of BrianFord
BrianFordFlag for United States of America

asked on

Excel Object doesn't support this property or method

I have inherited a workbook with  'lots' of VBA code, the code has been working fine for along time and today it started to throw the above error, of course "no-one has made any changes" :)

The error is appearing throughout multiple routines but all seems to be similar, here's one section that's throwing the error:

Sub Search()

    Set formSheet = Worksheets("Form1")

    <snip>

    With formSheet
        .textbox10.Text = "" <==== this throws the error
    End With

    <snip>
End Sub

Open in new window


I have verified that textbox10 is a valid control on the form(worksheet)

any ideas would be welcome

thank you
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Do you have a control named textbox10?
Avatar of BrianFord

ASKER

yes (as mentioned above).

I get the same error on 'any' control on the worksheet, and even the same error on other controls on other worksheets that are being referenced in the same manner.

It's as though something has changed 'globally' in the file but I can't figure out what???
Try closing Excel completely and reopening the workbook.
Sorry, but this has been done multiple times, the file has even been copied from on PC to another and still get the same error
I was able to reproduce the issue in a new file:

created a new macro enabled file
added a button and a label called lblName to sheet1
put the following code behind the button

Sub Button1_Click()
    Dim theValue As String
    Set theForm = Worksheets("Sheet1")
   
    With theForm
      .lblName.Text = "" <=== get the object error here
    End With

End Sub
Can you post that workbook please?
ASKER CERTIFIED SOLUTION
Avatar of BrianFord
BrianFord
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Have you tried the fix that suggested there?

If you post your workbook and it works for me then that will give evidence that thats the problem.
I did try the fix and it didn't work, if you try to reproduce using my example above that would also be evidence that i's the problem
The fix in the article worked on all but one of my PC's so the MS update was definitely the culprit