Link to home
Start Free TrialLog in
Avatar of RGuillermo
RGuillermoFlag for United States of America

asked on

HOw to open a excell file from visual basic on top of all windows

Hello Experts
I need to learn how to open on top of all windows.
Does not have to stay on top.
Just needs to open on top of all windows.

The code works just fine
Only it opens in the back of all windows.
Regards,

Dim appExcel As Object
  Set appExcel = CreateObject("Excel.Application")

  Dim objBook As Object
  Set objBook = appExcel.Workbooks.Add

  Dim objsheet As Object
  Set objsheet = objBook.Sheets("Sheet1")
  appExcel.Visible = True
  appExcel.WindowState = xlMaximized

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of SiddharthRout
SiddharthRout
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In fact use API SetForegroundWindow from vb6

http://allapi.mentalis.org/apilist/SetForegroundWindow.shtml

Sid
Avatar of RGuillermo

ASKER

Thank you!!