Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel 2007 not in foreground when launched in Vista or Windows 7
Try the following.
After .Visible = True AppActivate ("Microsoft Excel") -- Regards, OssieMac |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
2003 Excel Windows XP to 2007 Excel Windows Vista | Excel Programming | |||
Excel 2007/Windows Vista opening seperate instances. | Excel Discussion (Misc queries) | |||
Windows Speech Recognition not working with Excel 2007 in Vista Small Business | Excel Discussion (Misc queries) | |||
office 2007 excel and windows vista ultimate | Excel Discussion (Misc queries) | |||
Windows Vista - Excel 2007 - Excel 2003 | Excel Discussion (Misc queries) |