Mike
Mike

Reputation: 2313

Method or data member not found

I get this error when I run my code. This is a continuation from this post: Adding a scroll bar to a label

I first created a userForm that had labels that retrieved information from a worksheet. I wanted a scroll bar added so that I could view the list in the label if it was longer than the label. I was told to try a text box. I took this line from my code:

reportDate.Caption = reportDate.Caption & Sheets("DATA2").Range("P" & rowNum).Text & vbCrLf

and copied it and just added a number 1 after it for the text box so the code for the text box is:

reportDate1.Caption = reportDate1.Caption & Sheets("DATA2").Range("P" & rowNum).Text & vbCrLf

It is this line where there is an error (the title of the post).

enter image description here

Upvotes: 0

Views: 3079

Answers (2)

chris neilsen
chris neilsen

Reputation: 53135

Did you create a text box object called reportDate1 or just copy the code?

If there is no object called reportDate1 and no variable Dimed and no Option Explicit statement at the top of the module then reportDate1 will be a variant, which has no Caption Method or property

Something starnge in the neighbourhood... below is a screen shot of a simple test case in developement mode and run mode. Text is an arbitary string, no line breaks. Version/OS may be an issue? I used Windows Excel 2010.

enter image description here

Upvotes: 2

Tod
Tod

Reputation: 8232

And did you create an object named reportDate1 on your form?

Upvotes: 0

Related Questions