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 label开发者_StackOverflow中文版s 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).
Did you create a text box object called reportDate1
or just copy the code?
If there is no object called reportDate1
and no variable Dim
ed 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.
And did you create an object named reportDate1 on your form?
精彩评论