How do you bring an application up as the top most window. I have two excel files opened up in excel. I close the first file, then reopen it up. But I want the second file to be as the top most window. How do you accomplish that without closing the second file and reopening it. I need to do this in dispatch in win32com only.
import time, os.path, os
from win32com.client import Dispatch
path1 = 'C:\\Todolist.xls'
path2 = 'C:\\Todolist2.xlsx'
xla = Dispatch("Excel.Application")
xla.DisplayAlerts = False
xla.Visible = True
xl = Dispatch("Excel.Application")
xl.DisplayAlerts = False
xl.Visible = True
wb1= xla.Workbooks.Open(Filename=path1)
wb2= xl.Workbooks.Open(Filename=path2)
wb1.Close()
time.sleep(3)
wb1= xl.Workbooks.Open(Filename=path1)
#Need to bring wb2 back as the top most window