vba 我可以/如何以 excel 表格显示网页?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21859096/
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-12 01:59:42  来源:igfitidea点击:

Can I/How do I show a webpage in an excel form?

vbaexcel-vbaexcel

提问by cquadrini

I making a spreed sheet to evaluate user experience of a web page. I am wondering, can I have the user open a workbook, have a form pop-up show a webpage in one portion and have questions in another portion. The webpage has to be active and not an image. If it is doable, can I be provided direction in terms of another post or website? Thank you.

我制作了一个电子表格来评估网页的用户体验。我想知道,我可以让用户打开一个工作簿,让一个表单弹出窗口在一个部分显示网页并在另一部分有问题。网页必须是活动的,而不是图像。如果可行,是否可以在其他帖子或网站方面为我提供指导?谢谢你。

enter image description here

在此处输入图片说明

回答by Jerome Montino

It is possible. You should use the WebBrowsercontrol in your Userform.

有可能的。您应该WebBrowserUserform.

In the VBE, go to Tools, then Additional Controls. Enable Microsoft Web Browser.

在 VBE 中,转到Tools,然后Additional Controls。启用Microsoft Web Browser

enter image description here

在此处输入图片说明

A new icon in your Toolboxshould show up. It's the WebBrowsercontrol. Add it to your userform.

Toolbox应该会出现一个新图标。这是WebBrowser控制。将其添加到您的用户表单中。

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

Code is up to you. Sample follows:

代码由您决定。示例如下:

Private Sub UserForm_Initialize()
    Me.WebBrowser1.Navigate "http://www.google.com"
End Sub

The above code navigates the control to Google when you start up the userform, like so:

当您启动用户表单时,上面的代码将控件导航到 Google,如下所示:

enter image description here

在此处输入图片说明

Hope this helps.

希望这可以帮助。

回答by Tarik

Use the WebBrowser ActiveX control. See http://msdn.microsoft.com/en-us/library/aa752043(v=vs.85).aspx

使用 WebBrowser ActiveX 控件。请参阅http://msdn.microsoft.com/en-us/library/aa752043(v=vs.85).aspx