在实施ERP过程中,需要用到百度一下搜索,故写了以下代码,只需要将ieElement(0).Value="卓丽栋"中的文字换成想要搜索的关键字即可。
SubUseInternetExplorer()OnErrorGoToxDimieAppAsObjectSetieApp=CreateObject("InternetExplorer.Application")ieApp.Visible=TrueieApp.Navigate"http://WWW.BAIDU.COM"DoWhileieApp.BusyLoopDimieElementAsObjectSetieElement=ieApp.Document.getElementByID("f")ieElement(0).Value="卓丽栋"'—-利用循环语句在判断哪个表单元素是可以单击的,避免了出错现象Fori=3To20ieElement(i).ClickNextx:Debug.Printi-1EndSub利用上述代码无需在工具–引用–中勾选MicrosoftInternetcontrols。极大提高了实用性。
ERM软件开发
风景如何,其实并不重要。重要的是,你在我的身边。