Button VBS脚本将程序带到前端

Button VBS脚本将程序带到前端,button,vbscript,click,window,Button,Vbscript,Click,Window,我正在编写VBS代码以打开Internet Explorer并访问www.google.com。但是,当我运行该程序时,它会打开并导航到www.yahoo.com,但Internet Explorer不是前面的窗口。有人能帮我吗?有没有一个代码可以让我把InternetExplorer带到前台?谢谢大家!!这是我的密码: Option Explicit Dim ie Set ie = CreateObject("InternetExplorer.Application") ie.Navi

我正在编写VBS代码以打开Internet Explorer并访问www.google.com。但是,当我运行该程序时,它会打开并导航到www.yahoo.com,但Internet Explorer不是前面的窗口。有人能帮我吗?有没有一个代码可以让我把InternetExplorer带到前台?谢谢大家!!这是我的密码:

Option Explicit
 Dim ie


Set ie = CreateObject("InternetExplorer.Application")

ie.Navigate("wwww.yahoo.com")
最后一个问题-是否有代码可以用来单击某个按钮-特别是我无法通过按“tab”来访问的按钮


谢谢大家!

这在我的电脑上运行它打开IE并加载www.google.com:

Dim oShell
Set oShell = CreateObject("WScript.Shell")
oShell.Run ("iexplore www.google.com")
至于你的最后一个问题。。。可能吧,但你需要更具体一些,可能应该问另一个问题。

试试这个:

Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "http://www.yahoo.com/"
Do While ie.Busy : WScript.Sleep 100 : Loop
ie.Visible = True
CreateObject("WScript.Shell").AppActivate ie.document.title

我发现在调用AppActivate方法之后,将Visible属性设置为True,可以在@daniel cook工作

因此,在@ansgar wiechers的示例中,只需交换最后2行即可得到所需的结果

Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "http://www.yahoo.com/"
Do While ie.Busy : WScript.Sleep 100 : Loop
CreateObject("WScript.Shell").AppActivate ie.document.title
ie.Visible = True

不适合我。它激活了应用程序,但没有使其出现:(