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.