全部代码:
'Dim web As System.Windows.Forms.WebBrowser = Forms("公司SCF系统").Controls("WebBrowser1").Basecontrol
Dim web1 As System.Windows.Forms.WebBrowser = Forms("公司SCF系统").Controls("WebBrowser2").Basecontrol
' web.Navigate("http://。。。。")
' web.Navigate("http://。。。")
Do Until web1.ReadyState = 4
Application.DoEvents
Loop
' web.Document.GetElementById("UserName").SetAttribute("Value", "...")
' web.Document.GetElementById("Password").SetAttribute("Value", ".....")
' web.Document.GetElementById("btnSubmit").InvokeMember("click")
Forms("公司SCF系统").Show()
web1.Navigate("http://。。。。。")
Forms("公司SCF系统").controls("Textbox1").Text = "下线条码打印"
'web1.Document.Window.Frames("公司SCF系统").Document.GetElementById("ctl00_C_frmSCXMC").SetAttribute("Value", "新疆1线") '获得第二个FrAMES框架里面的ID为"username"的的HTML标签元素,并且将其Value设置为"test138"
'web1.Document.Window.Frames("公司SCF系统").Document.GetElementById("ctl00_C_frmDPH").SetAttribute("Value", "MJ000062") '获得第二个FrAMES框架里面的ID为"pwd1"的的HTML标签元素,并且将其Value设置为"a110110"
'如果元素不是在Frame框架中,那么直接 web.Document.GetElementById 即可
web1.Document.GetElementById("ctl00_C_frmStart").SetAttribute("Value", "2021-03-01") '查询-开始时间
web1.Document.GetElementById("ctl00_C_frmEnd").SetAttribute("Value", "2021-03-31") '查询-结束时间
web1.Document.GetElementById("ctl00_C_frmSCXMC").SetAttribute("Value", "新疆1线") '生产线
web1.Document.GetElementById("ctl00_C_ischeck").SetAttribute("Value", "9")'"全部") '状态
web1.Document.GetElementById("ctl00_C_frmDPH").SetAttribute("Value", "MJ000062") '底盘号
web1.Document.GetElementById("ctl00_C_btnSearch").InvokeMember("click") '点击查询按钮
代码在一个窗口的按钮的Click事件,调用Forms("公司SCF系统")窗口出现查询数据!
请老师费心!
[此贴子已经被作者于2021/3/4 17:58:29编辑过]