Using ShellExecute

I am using ShellExecute to launch attachments stored in an RTF on a document. The script run just fine if I launch it from the document using an action button. But i also want to launch it directly when users try to open that document from a view as there is nothing else store in the document. In this case also the document is launched using the associated program but the focus always returns back to the view. Is there a way to force the way to be on the newly launced window of the attachment

Here’s the code -

Set contract = rtitem.GetEmbeddedObject( contracts(0).Name )

'copy the selected attachment to windows\temp folder then use shellexecute to open

Dim FileName As String, UniqueVar As Variant

'UniqueVar = Evaluate( “@Unique”, doc )

FileName = |~| & contract.Name

If Not ( contract Is Nothing ) Then

filetype = Right( contract.Name, 3 )

filepath = "c:\windows\temp" & FileName

Call contract.ExtractFile( filepath )

ShellExecute 0,“open”, filepath, “”, “”, 1

thanks.

Subject: using ShellExecute

I cant find shellexecute on this clien (6.5) - what does that sub or function look like?

Subject: using ShellExecute…try this

Hi

Maybe this will be better:

ShellExecute 0,“open”, filepath, “”, “”, SW_SHOWMAXIMIZED

or

ShellExecute 0,“open”, filepath, “”, “”, SW_SHOWMAXIMIZED

I think you are using SW_MAXIMIZE which does not activate the window.

regards

Jesper Kiaer

http://www.jezzper.com

Subject: RE: using ShellExecute…try this

I tried using the SW_SHOWMAXIMIZED, but that didn’t make a difference. This is only an issue when i try to view the attachment directly by double clicking on the document in the view. So it opens the document and on query open just calls the script to view attachment…and at that point the focus always goes back to the view rather than the launched document. This is not an issue when launching the attachment from within the document.