Fill out website text box using VBA code

crfangmann

New Member
Joined
May 28, 2014
Messages
2
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:
<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.
<style type="text/css">
.img { vertical-align: text-bottom; border: none; }img { border: none; }body { font-style: normal; font-variant: normal;
</style><style type="text/css">
.img { vertical-align: text-bottom; border: none; }img { border: none; }body { font-style: normal; font-variant: normal;
</style>
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
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?
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top