?
Solved

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

Posted on 2011-02-26
3
Medium Priority
?
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 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