Solved

Making excel always active so a Userform when triggered always appears on top

Posted on 2010-09-03
8
347 Views
Last Modified: 2012-05-10
I have a excel VBA macro that runs on a machine along with several applications. The macro is continuously scanning Atttachamate Extra session for certain conditions and if the condiditions are met the Userform pops up for 30 seconds. The problem I have is that is the excel spreadsheet is not visible on the actual screen the Userform gets hidden when it pops up. Is there any way to ensure that either the excel sheet is always on top of the other applications (i.e activate command at the end of the code) or program the Userform to always be on top of all active applications? This is how I call the userform now  

ALERTForm.Show vbModal
0
Comment
Question by:macrohappy
  • 3
  • 3
  • 2
8 Comments
 
LVL 33

Expert Comment

by:jppinto
ID: 33599246
Take a look at this example:

http://xcelfiles.homestead.com/API_10.html

jppinto
0
 
LVL 33

Expert Comment

by:jppinto
ID: 33599264
0
 
LVL 33

Expert Comment

by:jppinto
ID: 33599275
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 13

Expert Comment

by:MWGainesJR
ID: 33599603
Just put this before showing the userform.
Windows("MyExcel.xls").activate
 
0
 

Author Comment

by:macrohappy
ID: 33599633
MWGainesJR: I did just now add that to the code but the excel spreadsheet itself does not come to the front is that expected? I have not yet tested for the userform as it is a little cumbersome for  the conditions to be met to trigger the parameters
0
 
LVL 13

Expert Comment

by:MWGainesJR
ID: 33599673
you mean like sheet1?
Windows("MyExcel.xls").activate
workbooks("MyExcel.xls").sheets("Sheet1").activate
0
 
LVL 13

Accepted Solution

by:
MWGainesJR earned 500 total points
ID: 33599721
If you run:
Windows("MyExcel.xls").activate
from VBA Editor, Excel will not cover VBA Editor.  This is expected.   If for example you have two workbooks open "book1" and "Myexcel.xls"
If you create:
Sub activate()
Windows("MyExcel.xls").activate
end sub
in book1 and run Activate() from book1 by choosing it in the macro list (ALT+F8)......myexcel.xls will pop up.....
0
 

Author Closing Comment

by:macrohappy
ID: 33599758
Works like a charm..Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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 create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

840 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