Help populating <text area> on website with VBA

iliauk

Board Regular
Joined
Jun 3, 2014
Messages
163
Hi All,

We have moved website and I was trying to write a VBA macro to automatically fill the new site with the old site's contents. I can populate the normal text fields; however I can't populate the 'main' box which let's you write HTML text.

I can't seem to reference it and add a value - it appears the text area contains an iframe which converts any typed text into HTML and that get's loaded into the box. It would be of great help if I could also fill it. This is the HTML surrounding the box:

Code:
******** tabindex="0" title="Rich Text Editor, field_id_14, Press ALT 0 for help" class="cke_wysiwyg_frame cke_reset" aria-describedby="cke_37" src="javascript:void(function(){document.open()%3B(function()%7Bfor(var%20a%3B%3B)try%7Ba%3Dwindow.parent.document.domain%3Bbreak%7Dcatch(e)%7Ba%3Da%3Fa.replace(%2F.%2B%3F(%3F%3A%5C.%7C%24)%2F%2C%22%22)%3Adocument.domain%3Bif(!a)break%3Bdocument.domain%3Da%7Dreturn!!a%7D)()%3Bdocument.close()%3B}())" frameborder="0" style="width: 100%; height: 100%;" allowtransparency="true">*********>

2w3nszd.jpg


The code I have current:

Code:
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True


ie.navigate ("http://cra.treatdigital.com/admin.php?/cp/content_publish/entry_form&channel_id=7&S=aa0421849b1c522426223cf0459cde3e")
    
While ie.readyState <> 4
    DoEvents
Wend
            
ie.document.getElementById("username").Value = "xx"
ie.document.getElementById("password").Value = "yy"
        
Sleep 1000
            
Set els = ie.document.getElementsByTagName("input")
For Each el In els
    If el.Value = "Login" Then el.Click
Next el


Sleep 1000


'ie.document.getElementById("cke_1_contents").getElementsByTagName("iframe")(0).Value = "TEST"


Set els = ie.document.getElementsByClassName("holder")
For Each el In els
    Debug.Print el.uniqueID
    
    Select Case el.uniqueID
    Case "ms__id3"
        el.Children(0).Value = "test_title_cell2"
        
    Case "ms__id4"
        el.Children(0).Value = "test_url_cell2"
        
    'Big INPUT
    Case "ms__id5"
        Debug.Print el
    
    Case "ms__id6"
        el.Children(0).Value = "02/01/01 2:34 PM"
    End Select
Next el


Sleep 1000
ie.document.getElementById("submit_button").Click

Thanks very much! Also any alternative ideas about this (e.g. submit POST request?) much appreciated
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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