TysonLPrice
Programmer
An application opens word with the code I'll post below. The first time it opens Word 2003 it is on top of the current form. After closing and opening subsequent documents they all stay behind the current form. This only happened on a few machines. I've made sure the same Word software is running, same MDACs, Word options, etc. I'm basically stuck.
The application runs through some logic to take the extension and find out what to use to open the file. Then it uses the following code to launch it. Word pops up right at the code under the comment ' Start the shelled application:
The contents cmdline& in the bolded code is:
C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE "C:\DOCUME~1\pricet\LOCALS~1\Temp\tprice\Attachments\SI HOSPITAL INFO REQUEST.DOC - 20080520 065039.DOC"
The key to me is it is only behaving that way on certain machine. What could be different to make it come up on top of the form the first time and behind it after that?
The application runs through some logic to take the extension and find out what to use to open the file. Then it uses the following code to launch it. Word pops up right at the code under the comment ' Start the shelled application:
Code:
Private Sub ExecCmd(cmdline$, proc As PROCESS_INFORMATION)
'Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim Ret&
Dim bMissingProc As Boolean
Dim lWaittime As Long
bMissingProc = False
lWaittime = 1 ' 1 milliseconds
DoEvents
' Initialize the STARTUPINFO structure:
start.cb = Len(start)
' Start the shelled application:
Ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
' Wait for the shelled application to finish:
Ret& = WaitForSingleObject(proc.hProcess, lWaittime)
proc.lReturn = Ret&
If proc.lReturn = 0 Then
Ret& = CloseHandle(proc.hProcess)
End If
end sub
The contents cmdline& in the bolded code is:
C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE "C:\DOCUME~1\pricet\LOCALS~1\Temp\tprice\Attachments\SI HOSPITAL INFO REQUEST.DOC - 20080520 065039.DOC"
The key to me is it is only behaving that way on certain machine. What could be different to make it come up on top of the form the first time and behind it after that?