Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2007 not in foreground when launched in Vista or Windows 7

Hello,

I used the following code to launch excel 2007 in Vista or Windows 7 through
automation:

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

'Check whether Excel is installed
If objExcel Is Nothing Then
MsgBox "MS Excel is not installed", vbOKOnly
Else
With objExcel
.Workbooks.Open <filename
.UserControl = True
.Visible = True
End With
End If

Excel is launched but does not come to the foreground as it used to be in
Windows XP or windows 2003 server.

NOTE: I found the same effect when i launch Word 2007 in Vista, Windows 7
and Windows 2008 server. Also I tested office 2003 in Vista and i have the
same effect ... It seems that this behaviour is caused by Vista based OS.

Does anyone have the same problem?
Any solution for it?

Thanks in advance!
Madan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Excel 2007 not in foreground when launched in Vista or Windows 7

Try the following.

After .Visible = True

AppActivate ("Microsoft Excel")

--
Regards,

OssieMac


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2007 not in foreground when launched in Vista or Windows

Thanks!

It works but do you know why we need to additioanlly call the AppActivate
from Vista onwards?

It is an extra work for us to add AppActivate to everywhere word or excel is
launched.

Madan
"OssieMac" wrote:

Try the following.

After .Visible = True

AppActivate ("Microsoft Excel")

--
Regards,

OssieMac


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Excel 2007 not in foreground when launched in Vista or Windows

Hi Madan,

I don't know the reason. I guess that it is something to do with how windows
sets its priorities. However, you should realize that while most of the time
AppActivate is not required with Windows XP, it is not 100% reliable and
sometimes the new application is not the top active window.

I use Outlook to send automated emails and have an option for the user to
Display and edit the email if required. I found that most of the time the
newly created email would be the top active window but sometimes not.

Just for interest an example of the code I use for the newly created email
is as follows (the new Outlook email message takes its window name from the
Subject).

strSubject = "My Test email subject"

AppActivate(strSubject & " - Message")

It does not need the HTML, Rich Text or Plain text that is included in the
window name but it needs the " - Message" appended to the subject name.

--
Regards,

OssieMac


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2007 not in foreground when launched in Vista or Windows

This behaviour happens in all of the Vista based OS like Vista, windows 2008,
Windows 7 and Windows 2008 R2. This goes to show that XP would be the
preferred OS for some more time until Vista based OS becomes more reliable
and consistent.

Madan

"OssieMac" wrote:

Hi Madan,

I don't know the reason. I guess that it is something to do with how windows
sets its priorities. However, you should realize that while most of the time
AppActivate is not required with Windows XP, it is not 100% reliable and
sometimes the new application is not the top active window.

I use Outlook to send automated emails and have an option for the user to
Display and edit the email if required. I found that most of the time the
newly created email would be the top active window but sometimes not.

Just for interest an example of the code I use for the newly created email
is as follows (the new Outlook email message takes its window name from the
Subject).

strSubject = "My Test email subject"

AppActivate(strSubject & " - Message")

It does not need the HTML, Rich Text or Plain text that is included in the
window name but it needs the " - Message" appended to the subject name.

--
Regards,

OssieMac


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
2003 Excel Windows XP to 2007 Excel Windows Vista jadeB Excel Programming 1 August 11th 08 07:23 PM
Excel 2007/Windows Vista opening seperate instances. briant97 Excel Discussion (Misc queries) 0 June 6th 08 02:09 PM
Windows Speech Recognition not working with Excel 2007 in Vista Small Business [email protected] Excel Discussion (Misc queries) 1 February 15th 08 02:38 AM
office 2007 excel and windows vista ultimate Tom Excel Discussion (Misc queries) 1 December 20th 07 03:16 PM
Windows Vista - Excel 2007 - Excel 2003 LaDdIe Excel Discussion (Misc queries) 7 July 12th 07 02:55 AM


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

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

About Us

"It's about Microsoft Excel"