vba 如何刷新 WebBrowser Control MS Access
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19749233/
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
How refresh a WebBrowser Control MS Access
提问by user2607028
How refresh a webbrowser control on MS Access 2010?
如何刷新 MS Access 2010 上的浏览器控件?
I'm trying this:
我正在尝试这个:
Private Sub Btn_Report_Click()
'Create the report HTML...
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:\Windows\Temp\test_report.html")
message= "Test of line on variable"
objFile.WriteLine (message)
objFile.WriteLine ("This is the second line")
objFile.Close
End Sub
The webcontrol have this on Control Source property
webcontrol 在 Control Source 属性上有这个
="C:\Windows\Temp\test_report.html"
Thank you,
谢谢,
回答by Santosh
When the ControlSource property of webBrowser control is changed/updated it refreshes the webBrowser control on the form automatically.
当 webBrowser 控件的 ControlSource 属性更改/更新时,它会自动刷新表单上的 webBrowser 控件。
Having said that you can use the below trick (generate random number at the end of url)
话虽如此,您可以使用以下技巧(在 url 末尾生成随机数)
Form_frm_Codes.WebBrowser.ControlSource = "=""D:\abcd.html?rnd=" & Int((300 - 200 + 1) * Rnd + 200) & """"
回答by user2607028
I did it.
我做到了。
Show_Report.SetFocus
SendKeys "{F5}"
Where Show_Report is the name of the Control: WebBrowser Control from MS Access.
其中 Show_Report 是控件的名称:来自 MS Access 的 WebBrowser 控件。
Thank you.
谢谢你。
回答by Pete
In my case I was referring to a local file which only started to exist after creating a certain button. I solved it by:
就我而言,我指的是一个本地文件,该文件仅在创建某个按钮后才开始存在。我通过以下方式解决了它:
Webbrowser1.ControlSource = "=""about:blanc"""
Webbrowser1.ControlSource = "=""N:\My Documents\test.xml"""
回答by mikeyy
Very late, however:
然而,很晚了:
wWebBrowserControl.Object.Refresh