使用VBA上传到Web

问题描述 投票:0回答:1

<div id="xe-editor-container-1" class="input_area xpress_xeditor_editing_area_container" style="height: 400px;">
 <iframe id="editor_iframe_1" allowtransparency="true" frameborder="0" src="http://my_URL.or.kr/xe/modules/editor/styles/default/editor.html" scrolling="yes" style="width: 100%; height: 400px; display: block;">
      <html xmlns="http://www.w3.org/1999/xhtml>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <link rel="stylesheet" type="text/css" href="editor.css">
      <title>XpressEngine</title>
      </head>
      <body class="xe_content editable"></body>
      </html>			
 </iframe>
 <textarea id="xpress-editor-1" rows="8" cols="42" style="display: none; width: 100%;"></textarea>
 <textarea rows="8" cols="42" class="input_syntax " style="display:none"></textarea>
</div>

我想复制Sheet1上的两个表,ListObjects(“Tbl1”),Sheet2上的ListObjects(“Tbl2”),并将它们作为单个帖子上传到Web上。

每次都可以更改表格的范围。

登录到Web,导航到公告板,按下写入按钮并输入标题成功。

但我没有上传帖子。

也许你找不到公告板对象。

我通过搜索网络创建的代码。

上面的HTML是主板的HTML代码。

With ie
    .navigate "http://my_URL/offering"
    ieBusy ie   'Procedure fetched as search (check the ready status)

    .Document.getElementsByClassName("ico_16px write")(0).Click
    ieBusy ie

    Dim oTitle As Object, Ocontents As Object

    Set oTitle = .Document.getElementsByname("title")(0)   'Sometimes fail(sometimes Nothing)
    Set oContents = .Document.getElementsByClassName("xe_content editable")(0) 'evry time fail(=Nothing)

    oTitle.Value = "my Title"
    oContents.Value = ????
    .Document.forms(0).submit   'I could not confirm it because it did not work anymore.

End With
Sub ieBusy(ie As Object)
    Do While ie.Busy Or ie.readyState < 4
        DoEvents
    Loop
End Sub

标题HTML

enter image description here

董事会HTML

enter image description here

excel vba web upload
1个回答
0
投票

1)使用额外的定时循环根据oTitle设置https://stackoverflow.com/a/55334183/6241235

2)你的oContents变量正在选择我认为在iframe内部的元素。我希望你的目标是textarea元素。在iframe之后有两个。第一个有id xpress-editor-1

© www.soinside.com 2019 - 2024. All rights reserved.