+ Reply to Thread
Results 1 to 8 of 8

Need help reading IE textarea using Excel 2010 VBA

  1. #1
    Registered User
    Join Date
    11-06-2013
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    19

    Need help reading IE textarea using Excel 2010 VBA

    Hello,

    I am trying to read the value of a IE8 textarea using Excel 2010 VBA 7. The error I get is: "Object doesn't support this property or method" in relation to this line of code:
    OldNotes = OldNotes.Value

    I have also tried .innerText instead of .Value and get the same error.

    Here is the website source that relates to the textarea:

    Please Login or Register  to view this content.
    Here is the VBA code I am using to try and read the text area:

    Please Login or Register  to view this content.
    Thanks in advance,
    Matt

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need help reading IE textarea using Excel 2010 VBA

    Did you declare (Dim) OldNotes somewhere?

    Maybe just try this.
    Please Login or Register  to view this content.
    Or this...
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    11-06-2013
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Need help reading IE textarea using Excel 2010 VBA

    Thanks for your suggestions, but I get the same error: "Object doesn't support this property or method".

    A textarea can be defined as an Object, and .Vaule and .innerText are valid properties, correct?

    I've also tried defining it as an HTMLTextArea and HTMLTextAreaElement. If I don't use "Set Oldnotes" I get an Object variable not set error, if I do use "Set Oldnotes", I get a Type mismatch error.

    The script worked when the data was just in a table, but now that it's in a textarea, it doesn't. I've been trying to solve this for several days with no luck, it’s very frustrating.

  4. #4
    Registered User
    Join Date
    11-06-2013
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Need help reading IE textarea using Excel 2010 VBA

    Maybe this will help someone figure it out. I've attached a workbook with an example. Just click the "Read Textarea" button and it will open a webpage that has a textarea in it. It will then attempt to read the textarea and display it in a message box, but it will give the error I'm getting. For some reason I am unable to get the Value or innerText of a textarea.

    If you would prefer to create a new workbook, here is the code. Just make sure you add the Microsoft Internet Controls Reference and the Microsoft HTML Object Library Reference in the visual basic editor (Tools->References) or it won't run:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need help reading IE textarea using Excel 2010 VBA

    This worked for me using your example workbook.

    Please Login or Register  to view this content.
    The use of the END statement was not the problem. Avoiding it is just good practice.

    This was the fix
    strNotes = objNotes(0).Value

    Apparently (not sure) the TextArea returns a collection or an array. So use an index number to specify an element e.g.; objNotes(0)

    Also, you were trying to assign a string to an object variable. That also causes an error. The new code uses an object variable and a string variable.

  6. #6
    Registered User
    Join Date
    11-06-2013
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Need help reading IE textarea using Excel 2010 VBA

    Thanks for the help. Your suggestion worked on the example I provided. Unfortunately I still get the same error on the website I am trying to pull from. Unfortunately it's an intranet website, so I can't post the exact problem. This is a step in the right direction though. I'll keep plugging away at it and post the solution once I find it.

  7. #7
    Registered User
    Join Date
    11-06-2013
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Need help reading IE textarea using Excel 2010 VBA

    I think I've narrowed down the problem, but I don't know how to fix it yet. The textarea I am trying to pull a value from is in a popup radwindow. I need to figure out how to get my code to focus on the radwindow.

  8. #8
    Registered User
    Join Date
    11-06-2013
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Need help reading IE textarea using Excel 2010 VBA

    I'm marking this Thread as solved. The correction by AlphaFrog allows me to get the value of a textarea. My issue now is figuring out how to pull the information I need from a Child Window. I'll start a new Thread, as it is an unrelated issue.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Control IE website's "TEXTAREA" - Read & Replace value with VBA in excel.
    By R_S_6 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-19-2013, 01:49 AM
  2. Copying worksheets from excel to word in vba as images
    By papasideris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2012, 11:32 AM
  3. Searching the particular numberfrom excel'2010 table and locate the number in Word'2010
    By jaffirahamed1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2012, 08:09 AM
  4. [SOLVED] getting value of selected list item in a textarea
    By junoon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-31-2006, 10:55 PM

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