PermaLink Vista issue: Excel application always opens minimized 04/25/2008 09:34 AM
LotusScript

I've been researching a problem that appears to be related to Windows Vista, and am looking for help/guidance from any Notes <-> Office integration experts out there in Notes community.


When I run the following code within Windows XP, the Excel spreadsheet is opened and maximized on the user's desktop.  However, when I run the same code on Windows Vista, the Excel spreadsheet is opened but minimized in the Task Bar.


Const FILEPATH = "c:\Temp\Issues.xls"
 
Dim o As Variant

Dim oWB As Variant
 
Set o = CreateObject("Excel.Application")
 
o.EnableEvents = False
o.DisplayAlerts = False
 
Set oWB = o.Workbooks.Open ( FILEPATH )
 
o.Visible = True


I know I can use ActivateApp to resolve this, but that would require updating a lot of existing code.  Is there is a setting or a preference in Windows Vista that would restore the behavior users had with Windows XP and prior?


Comments :v

1. Joe Blow04/30/2008 09:06:06 PM


This is a test




2. Theo Heselmans04/30/2008 09:11:56 PM
Homepage: http://blog.xceed.be


Hi Michael,

I wanted to reply to your blog,
but every time I submitted, I got a 'Anti-Spam' page: { Link }
Check it out.

This is what I wanted to comment:

I just tried it on my machine: Notes 7.03/Vista SP1/Excel (2003 and 2007), and it opened as expected: NOT minimized.

Must be something on your PC. Try it on a user's PC.

Never had a problem with Vista/Office/Notes before.




3. Dietrich Willing06/30/2008 03:09:19 AM


I'm using Windows XP and I get your problem when I run lotusscript code that creates a Word Document for the first time after I've booted up the computer.

The way I fixed it was with some code! Here it is

Declarations

Declare Function SetFocusAPI Lib "user32" Alias "SetForegroundWindow" _
(Byval hwnd As Long) As Long
Declare Function GetWindow Lib "user32" (Byval hwnd As Long, _
Byval wCmd As Long) As Long
Declare Function FindWindow _
Lib "user32" Alias "FindWindowA" (Byval lpClassName As String, _
Byval lpWindowName As String) As Long
Declare Function SetForegroundWindow Lib "user32" (Byval hwnd As Long) As Long

Dim hwnd As Long

Dim wordFileName As String

Initialise

extractTo = extractWordTemplate("Supervisor SignOff", "(Templates)", doc)
' gets a document with an attachment and extracts the attachment to the temp directory.
' extractTo becomes the path to the file
' this also sets the wordFileName variable the name of the file

Set word = CreateMSWordDocument(True, extractTo)
' this creates a Word document that will show to the user
' the documentis to show is the one at extractTo

hWnd = FindWindow( "OpusApp", wordFileName + " - Microsoft Word")
' OpusApp is the class name of the Word Application
' FindWindow needs the second parameter, the window title of the Word document, to find the window

SetForegroundWindow(hWnd)
' does what it says




Credits
NuTechs Powered by Domino
Search
Calendar
August 2008
Su
Mo
Tu
We
Th
Fr
Sa
2
3
5
8
9
10
11
13
14
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Monthly Archive
Get Real, Detroit!
Real Detroit Weekly
SWARM
Service
With
A
Rapid
Motion


-- old Rally's Hamburgers credo
By Category
The BlogRoll
About
Contact Me
Contact me, Michael Sobczak, using this e-mail address:

my first initial my last name at Yahoo dot com
Recent Entries
No Recent Blogs
Powered by
Blogsphere