我目前正在使用以下脚本打开Excel。该脚本按照它的设想执行,但我需要它做的是将excel放在所有窗口的顶部。我目前在excel项目中有一个脚本将userforms放在所有窗口的顶部,但当我到达我项目中的某个点时,它会导致excel崩溃,所以我已经将它指向excel项目中的脚本。这是我用来打开excel文件的脚本:
Dim AppExcel
Set AppExcel = CreateObject("Excel.application")
AppExcel.Workbooks.Open "C:\Users\****\Desktop\ App Tool\App.xlsm"
AppExcel.Visible = False
答案 0 :(得分:2)
根据评论最小化每个打开的窗口,然后打开Excel。
Set shell = wscript.CreateObject("Shell.Application")
Shell.MinimizeAll ''Comment me if you don't want to minimize everything
'Then rest of your code
Dim AppExcel
Set AppExcel = CreateObject("Excel.application")
AppExcel.Workbooks.Open "C:\Users\****\Desktop\ App Tool\App.xlsm"
AppExcel.Visible = True
'And in the end Release the Shell object
Set shell = Nothing