It works on 2000, but not on XP

T

Tae-Yun Park

Hi all:

I'm in trouble finding why the following code works on 2000, but does
not work on XP:

---------------------------------------------------------------
Public Sub DoFortran1(Optional FakeArg As Integer)
Dim Program, i
Dim TaskID As Long
Dim hProc As Long
Dim lExitCode As Long

' Executing External Fortran Procedure with detecting process status
ACCESS_TYPE = &H400
STILL_ACTIVE = &H103&

Program = ThisWorkbook.Path & "\Lab_Sim.exe"
'On Error Resume Next

TaskID = Shell(Program, 0) 'Launching Fortran program
hProc = OpenProcess(ACCESS_TYPE, False, TaskID) 'Get the process
handle

If Err <> 0 Then
MsgBox "Cannot Start Fortran program " & Program, vbCritical,
"Error"
Exit Sub
End If

Do ' Looping to detect the program status to the end
Call GetExitCodeProcess(hProc, lExitCode)
DoEvents
UpdateProgress
Loop While lExitCode = STILL_ACTIVE

MsgBox "Fortran based calculation completed"

Unload Progress_FORTRAN

End Sub
----------------------------------------------------------------------

It is a VBA coding in Excel to execute a custom program in FORTRAN
called "Lab_Sim.exe". Anyone can tell me why this works on 2000, but
not on XP??

Thanks in advance.

TYP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top