+ Reply to Thread
Results 1 to 23 of 23

Compile Error: Method of data member not found (VBA)

  1. #1
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Compile Error: Method of data member not found (VBA)

    Hi,

    I created text boxes in 2 files, source_file.xlsm and destination_file.xlsm with the names TextBox1 and destTextBox respectively. I keep getting this error and not sure how to fix it. Can someone please help? I tried searching for similar issues but couldn't find anything that was specific to my issue.

    Compile Error: Method or data member not found.

    The goal is to copy the text in TextBox1 (from the source_file.xlsm) to DestTextBox (from destination_file.xlsm)
    I created the text box from Insert > Text Box

    Below is the code:
    Please Login or Register  to view this content.
    Below is a screenshot of the References I have set up:
    References - VBAProject.jpg

    Thanks in advance for your help.
    Last edited by vbatech; 03-06-2012 at 07:31 PM.

  2. #2
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Compile Error: Method of data member not found (VBA)

    Read the forum rules!
    Place the tags around the code

  3. #3
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile Error: Method of data member not found (VBA)

    Sorry about that, I have revised it to follow the forum rules.

  4. #4
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile Error: Method of data member not found (VBA)

    Hi Rory,

    Thanks for the help. I tried running the code and got this error
    Run-time error '438': Object doesn't support this property or method

    I also tried the following code and it doesn't work:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile Error: Method of data member not found (VBA)

    If anyone else has some thoughts, that would be helpful.

  6. #6
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Compile Error: Method of data member not found (VBA)

    If you get a runtime error then either you did not use ActiveX textboxes or you are looking at the wrong sheet. For the former, use
    Please Login or Register  to view this content.
    Good luck.

  7. #7
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: Compile Error: Method of data member not found (VBA)

    Quote Originally Posted by OnErrorGoto0 View Post
    The worksheet class does not have those text boxes. Declare both worksheet variables as Object instead. Note that you currently have both variables assigned to the workbook containing the code. I think you mean:
    Please Login or Register  to view this content.
    That was very interesting. Didn't realise that would work. Nice!

  8. #8
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Compile Error: Method of data member not found (VBA)

    Strictly speaking I should have said "The Worksheet interface does not implement those members." rather than "The worksheet class does not have those text boxes." but the net effect is the same.

  9. #9
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: Compile Error: Method of data member not found (VBA)

    Quote Originally Posted by OnErrorGoto0 View Post
    Strictly speaking I should have said "The Worksheet interface does not implement those members." rather than "The worksheet class does not have those text boxes."
    I was just about to point out your oversight, but then I saw you had corrected yourself

    <Runs away quickly>
    Last edited by Firefly2012; 03-07-2012 at 05:52 AM.

  10. #10
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Compile Error: Method of data member not found (VBA)

    Yep - I knew someone would point it out if I didn't mention it...

  11. #11
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile Error: Method of data member not found (VBA)

    Hi all, thanks for your response.

    I used the code that was suggested above and I am still getting Run-time error '438': Object doesn't support this property or method.

    Not sure why this keeps giving me this error message. In the debug mode, it seems to be stopping at this:
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile Error: Method of data member not found (VBA)

    Attached are the files, hopefully this helps. Thanks,

    Kevin
    Attached Files Attached Files

  13. #13
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Compile Error: Method of data member not found (VBA)

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile Error: Method of data member not found (VBA)

    Thanks Rory.

    Another question that I have is if I have text formatting such as bullet points, bold, etc. is there a way to save that formatting so that in the destination_file it has the same formatting?

    Also, in the actual text box it seems like formatting capabilities are not avaialble. For example, I can't bullet point the text without bulleting everything. Is there a way to fix this?

    Thanks,

    Kevin

  15. #15
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Compile Error: Method of data member not found (VBA)

    It's probably easier to just copy the whole text box to the other workbook?

  16. #16
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile Error: Method of data member not found (VBA)

    I think that might work. How would we be able to go about doing that?

  17. #17
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile Error: Method of data member not found (VBA)

    Hi Rory,

    Sorry for the change but I think it is best if we could copy and paste the text from one text box to another, with the formatting from the source file preserved when pasting to the destination file. Thanks,

    Kevin

  18. #18
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Compile Error: Method of data member not found (VBA)

    May I ask why? I think that will be a lot of code.

  19. #19
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile Error: Method of data member not found (VBA)

    Hi Rory,

    A few of the reasons being:
    - there are going to be multiple textboxes with specify names assigned to it in the destination file
    - location of the textbox is key in order to make my final file consistent each time that I run this macro

    The best way I believe is to do a copy and paste with formatting. Thanks,

    Kevin

  20. #20
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Compile Error: Method of data member not found (VBA)

    I'm afraid I think that will require more work than I have time for, unless I come across a simple method. Hopefully someone else will join in.

  21. #21
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile Error: Method of data member not found (VBA)

    Does anyone have any thoughts on how this would be possible?

  22. #22
    Registered User
    Join Date
    03-06-2012
    Location
    Newport Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile Error: Method of data member not found (VBA)

    Hi Rory, I haven't heard back from anyone else. I was hoping you might have a solution. Thanks,

    Kevin

  23. #23
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: Compile Error: Method of data member not found (VBA)

    I've never used them, but would using RichTextBoxes instead be an option? I presume it's easy to copy the formatting of the text from them (may be wrong here(. Alternatively with InkEdit controls you definitely can copy the Rich Text Formatted content so this again would be a relatively simple option (with the caveat you then have these less common ActiveX controls on your worksheet with the possible consequences they might bring).

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1