ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   works on 2000, but not on XP (https://www.excelbanter.com/excel-programming/305101-works-2000-but-not-xp.html)

Tae-Yun Park[_2_]

works on 2000, but not on XP
 
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




All times are GMT +1. The time now is 02:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com