Results 1 to 3 of 3

Thread: Fill out website text box using VBA code
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    May 2014
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Fill out website text box using VBA code

    Hi all,

    I am relatively new to VBA, and very new to HTML, and I am trying to connect the dots between the two. I have looked through many forums, and I can't quite seem to find what I need.

    I am trying to populate a web form with Excel VBA. I have been able to populate the rest of the form, but there is one specific field I can't seem to populate, titled "Description (Local Language)". I have posted the relevant part of the code below. Where it reads "test description" in the HTML is where I manually typed into the web form. I want to be able to populate that area using input from vba.

    HTML portion of code from website:
    HTML Code:
    <textarea id="rte2_fld_zRep3" name="fld_zRep3" style="margin: 0px; border: 0px; display: none; visibility: hidden; height: 167px; width: 491px;"></textarea>
    <span id="rte2_fld_zRep3_parent" class="mceEditor defaultSkin" style="display: block;">
    <table id="rte2_fld_zRep3_tbl" class="mceLayout" cellspacing="0" cellpadding="0" style="width: 491px; height: 167px;">
    <tbody>
    <tr class="mceFirst">…</tr>
    <tr class="mceLast">
            <td class="mceIframeContainer mceFirst mceLast">
                    ******** id="rte2_fld_zRep3_ifr" src="javascript:""" frameborder="0" style="width: 100%; height: 113px;">
                            #document
                                    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                                    <html>
                                            <head>
                                                    ****** http-equiv="X-UA-Compatible" content="IE=7">
                                                    ****** http-equiv="Content-Type" content="text/html; charset=UTF-8">
                                            <style type="text/css">
                                            .img { vertical-align: text-bottom; border: none; }img { border: none; }body { font-style: normal; font-variant: normal;
                                            </style>
                                    </head>
                            <body id="tinymce" class="mceContentBody " spellcheck="false" dir="ltr">
                                    <p>
                                            “test description”
                                    </p>
                            </body>
                    </html>
            *********>
            </td>
    </tr>

    Here is the vba code that works on the other fields, and the errors I receive when I try to populate the "Description (Local Language)" field.
    Code:
    With ieApp.Document.forms(1)
        .fld_XName.Value = "Test Title" 'works
        .fld_XEntity.Value = "Test" 'works
        .fld_XSpecifi.Value = "Test this field" 'works
        .fld_XClassif.Value = "SAF" 'works
        .fld_zTyp2.Value = 0 'works
        .fld_zRep2.Value = "First Name Last Name" 'works
        ‘.rte14_fld_zRep3.Value = "Test Description"  **error 438
        ‘.fld_zRep3.Value = "Test Description"  **no error, but does not populate the field
        ‘.rte6_fld_zRep3.Value = "Test Description"  **error 438
        ‘.STATUS_fld_zRep3.Value = "Test Description"  **error 438
        ‘.SEC13.Value = "Test Description"  **error 438
    End With
    I don't know how to access this part of the form from the vba. Any help would be much appreciated. Thank you.

  2. #2
    Board Regular vds1's Avatar
    Join Date
    Oct 2011
    Posts
    1,179
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Fill out website text box using VBA code

    I dont know about that. Here is some good resource about it.

    Navigate Internet Explorer using VBA - Access World Forums
    ---------------------------------------------------------------------------
    VDS1

    Using Office 2010

    Blog :
    http://wizardvba.blogspot.com



  3. #3
    New Member
    Join Date
    May 2014
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Fill out website text box using VBA code

    That did not work. I tried using the .getElementById().value and it gave me the same error. I think the issue is that it doesn't seem to be storing the response into any sort of html "variable." It seems to be writing it directly into the html code as shown above. How can I write into this field through vba?

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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