首页 文章

将程序带到前面的VBS脚本

提问于
浏览
3

我正在编写VBS代码以打开Internet Explorer并访问www.google.com但是当我运行程序时,它会打开并导航到www.yahoo.com但是Internet Explorer不是前台窗口 . 谁能帮我这个?有没有我可以使用的代码将Internet Explorer带到前面?谢谢你们!这是我的代码:

Option Explicit
 Dim ie


Set ie = CreateObject("InternetExplorer.Application")

ie.Navigate("wwww.yahoo.com")

最后一个问题 - 是否有一个代码我可以用来点击某个按钮 - 特别是按“标签”我无法访问的按钮?

谢谢你们!

3 回答

  • 2

    我发现将Visible属性设置为True after 调用AppActivate方法可以使用@ daniel-cook .

    因此,简单地交换@ ansgar-wiechers示例中的最后两行会产生所需的结果 .

    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
    
  • 0

    试试这个:

    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
    
  • 2

    这可以在我的计算机上打开IE并加载www.google.com:

    Dim oShell
    Set oShell = CreateObject("WScript.Shell")
    oShell.Run ("iexplore www.google.com")
    

    至于你的上一个问题......可能,但你需要更具体,并且可能应该问一个不同的问题 .

相关问题