Excel-使用VBA抓取HTML源布局

时间:2018-09-03 21:29:09

标签: excel vba excel-vba

我有一些经过精心设计的HTML,试图从中读取数据以便于阅读。

我可以使用innerHTML来获取信息,但不幸的是,它是一堆文字。

当我“查看源代码”(出于隐私目的更改单词)时,网页中的源代码示例为:

<td nowrap valign="top"><b>Logger Notes</b></td>
    <td valign="top">Hi,
Person needs a full breakdown Important information.
Would also would like confirmation in a letter about what kinds of assistance 
she is not eligible for if possible.
Would prefer sent to email.
Thanks&nbsp;</td>

但是,当我获取数据时,它就像是一堵墙:

Hi, Person needs a full breakdown Important information. Would also would like confirmation in a letter about what kinds of assistance  she is not eligible for if possible. Would prefer sent to email. Thanks

这显然很难阅读。

当我使用innerHTML并查看字符串时,所有换行符实际上都是空格字符,因此我不能使用replace

我已经搜索并尝试了许多不同的方法,但是我无法找到一种显示方法,因此很容易阅读。

该网页位于我们的工作Intranet上,并且已登录(使用电子表格的多个人都将使用-因此我无法自动执行此操作)

首选输出示例:

Hi,

Person needs a full breakdown Important information.

Would also would like confirmation in a letter about what kinds of assistance she is not eligible for if possible.

Would prefer sent to email.

任何建议将不胜感激。

1 个答案:

答案 0 :(得分:0)

也许在每个句点出现后添加换行符?

例如,replace"."的{​​{1}}