Solved

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

Posted on 2011-02-26
3
260 Views
Last Modified: 2012-05-11
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

0
Comment
Question by:rguillermo
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 500 total points
ID: 34990137
Are you doing this from vb.net or vb6 or Excel?

If you are doing this from Excel then by default it will be on top.

If you are doing this from vb6 then have a look at this link

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

If you are doing this from vb.net then there is a different set of code.

Sid
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 34990153
In fact use API SetForegroundWindow from vb6

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

Sid
0
 

Author Closing Comment

by:rguillermo
ID: 34992986
Thank you!!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question