使用 VBA 将 HTML 报告导入 Excel

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7237685/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 13:55:59  来源:igfitidea点击:

Importing HTML Report into Excel Using VBA

htmlvbaexcel-vbaexcel

提问by Nikon3D

When you right-click an html document (.html) and open as "Excel", Excel will open up and retain the html appearance in the sheet.

当您右键单击 html 文档 (.html) 并以“Excel”打开时,Excel 将打开并在工作表中保留 html 外观。

I am trying to write VBA code to import an HTML file (.html) into the worksheet while retaining the HTML look. (I do not want the html code to appear in the sheet).

我正在尝试编写 VBA 代码以将 HTML 文件 (.html) 导入工作表,同时保留 HTML 外观。(我不希望 html 代码出现在工作表中)。

How would I achieve this?

我将如何实现这一目标?

Thanks

谢谢

回答by Tim Williams

Dim wb as excel.workbook
set wb = workbooks.open("C:\test_file.html")