首页 > 解决方案 > 为非 Office 应用程序设置窗口参数的困难

问题描述

我有一个 Excel 应用程序 (PC W10),它启动 InternetExplorer 和各种网站,然后根据需要设置窗口大小。以下代码适用于 InternetExplorer –</p>

myLink = “some website url”
Set myInt = CreateObject("InternetExplorer.Application") 'launch IE
With myInt
    .Height = hig
        'etc. for other parameters
End With
myInt.Navigate2 myLink 'go to website
Do While myInt.Busy 'wait until all is done before doing anything else
Loop

但现在很多网站不再支持 IE,我需要换个浏览器(例如 FireFox、Chrome 或 Edge)——</p>

myLink = “some website url”
myInt = “FireFox”
appName = “firefox.exe"
appPath = "C:\Program Files\Mozilla Firefox\"
myApp = Shell(appPath & appName & " -url " & myLink)
    'Up to here all is well
    'The intended code below obviously does not work
With myInt
    .Height = hig
        'etc. for other parameters
End With
Do While myInt.Busy
Loop

上面可以启动浏览器和网站,但我找不到如何控制窗口的尺寸并创建等待循环。

我将不胜感激任何人可以给我的任何方向。

最好的问候

标签: excelvbashellfirefox

解决方案


推荐阅读