Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel VBA web刮取内部文本_Excel_Vba_Web - Fatal编程技术网

Excel VBA web刮取内部文本

Excel VBA web刮取内部文本,excel,vba,web,Excel,Vba,Web,我现在已经尝试了相当长的一段时间,在web上刮取这些内部文本: 我希望将值0606复制到Excel工作表中 <TABLE class="group" <td width="100%" nowrap="" colspan="3"> <input name="pg41_PolicyHolder_FogP_PolicyHolderId_FogP_IdentityQualifier" type="HIDDEN" value="CPR">CPR-nr: <input

我现在已经尝试了相当长的一段时间,在web上刮取这些内部文本: 我希望将值0606复制到Excel工作表中

<TABLE class="group"
<td width="100%" nowrap="" colspan="3">
<input name="pg41_PolicyHolder_FogP_PolicyHolderId_FogP_IdentityQualifier" 
type="HIDDEN" value="CPR">CPR-nr:
<input name="pg41_PolicyHolder_FogP_PolicyHolderId_FogP_IdentityValue" 
type="HIDDEN" value="0606">0606</td>
我已经尝试过get.attribute、getelementbyclassname、value和innertext,但现在我需要对其进行一些新的研究。
你们有什么好主意吗

类似的东西应该可以工作,但是如果没有您的代码,我不知道您是如何获得HTMLDocument的:


您可以使用CSS选择器,避免使用循环

input[name="pg41_PolicyHolder_FogP_PolicyHolderId_FogP_IdentityValue"]
VBA

当您的问题中未显示页面方法,但使用Internet Explorer时,可通过HTML文档集访问.querySelector,例如:

IE.document.querySelector("pg41_PolicyHolder_FogP_PolicyHolderId_FogP_IdentityValue").innerText
进一步资料:


这就是web源代码。如果你需要对你的代码有新的认识,发布你的代码不是一个好主意吗?你试过给出的答案了吗?
IE.document.querySelector("pg41_PolicyHolder_FogP_PolicyHolderId_FogP_IdentityValue").innerText