Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default How to make Excel the Top-Most application programmatically?

I have Excel checking a file every so often for a particular command,
and whenever it finds a certain command, I want it to bring Excel to the
front and prompt the user.

Similarly, I would like to be able to send Excel to the back whenever
some other command was inside a file.

How could I achieve this? Any help would be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to make Excel the Top-Most application programmatically?

I don't think you can do this. The closest you can come is to use

AppActivate Application.Caption

This will cause the Excel icon in the Taskbar to blink, but won't
actually make the application active.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"R Avery" wrote in message
...
I have Excel checking a file every so often for a particular

command,
and whenever it finds a certain command, I want it to bring

Excel to the
front and prompt the user.

Similarly, I would like to be able to send Excel to the back

whenever
some other command was inside a file.

How could I achieve this? Any help would be appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default How to make Excel the Top-Most application programmatically?


"R Avery" wrote in message
...
I have Excel checking a file every so often for a particular command,
and whenever it finds a certain command, I want it to bring Excel to the
front and prompt the user.

Similarly, I would like to be able to send Excel to the back whenever
some other command was inside a file.

How could I achieve this? Any help would be appreciated.


It can be done using the win32 API

In a code module declare the function

Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal
hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long,
ByVal cy As Long, ByVal Wflags As Long) As Long

then get the Excel Windows handle

Dim Winhandle as Long
Winhandle=Application.Hwnd

Then call the following sub

FloatWindow(Winhandle)


Public Sub Floatwindow(Winhandle As Long)
' -------------------------------------
' This routine makes the window who's
' handle is passed always on top
' -------------------------------------

Dim Wflags As Integer
Wflags = 2 Or 1
Call SetWindowPos(Winhandle, -1, 0, 0, 0, 0, Wflags)

End Sub

Keith




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make hyperlink to open another application that default one Jean-Luc Links and Linking in Excel 0 September 30th 09 07:12 PM
how to make Excel application GUI look better? cfman Excel Discussion (Misc queries) 1 March 26th 07 11:48 PM
VBA: Make Excel the active application Gaetan Excel Discussion (Misc queries) 0 March 19th 07 05:57 PM
How to make Excel feel switching application? kelsawy2000 Excel Programming 2 July 14th 04 09:11 AM
Does anyone know how to programmatically disable Application.xlcut Fonda Excel Programming 1 June 30th 04 01:58 AM


All times are GMT +1. The time now is 02:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"