Hey hi there Greg...
This is a typical problem with standard exes......
The return value of Shell is nothing but the ProcessId
or the TaskId of that process which is created by
"Shell"....Its the same value that u see on opening
the Task Manager...Shell runs the standard exe
asynchronously.....
I think a better way to record the return value is to
write into a log file thru the standard exe, rather
than depending on the application to return a
value....
Cheers...
Subbu.......
--- Greg <gregbyrne@w...> wrote:
> Background
> I am a developer in an enterprise production
> environment. I have
> developed a VBA application controlling a OLAP
> product(COGNOS)
> that runs on a weekly basis. There is one execuatble
> for each Cube/Report
> process. The VBA(standard type) executable is kicked
> off
> at the prescheduled time by NT Scheduler.
>
> The Problem
> I have appropriate error handling throughout the
> application, but the NT
> Scheduler needs a return code passed to it when the
> job
> ends that indicates success or failure. How do I
> send the appropriate
> return code upon error or successful completion.
>
> My Efforts
> To simulate the NT Scheduler environment I have
> created a master VB
> standard execuatble(master.exe) that calls another
> VB standard
> executable (test1.exe). I launch the test1.exe from
> the shell command as
> follows:
>
> RetVal = Shell("C:\Cognos\exetest\Test1.EXE", 1)
>
> Test1.exe does a simple task of: x = 5/1 for a valid
> condition and x = 5/0
> for an error condition.
>
> In either case I get a range of random numbers for
> RetVal, anywhere from
> 200-500. I cannot determine success or failure from
> these
> values.
>
> Options
> Should I consider either:
> Use the Win32API to run the ShellExecute API or the
> CreateProcess API?
>
> Note:
> I wish to avoid converting to an ActiveX execuatable
> to solve the problem
> due to lack of experience in ActiveX development and
> time
> constraints.
>
> Please give me your thoughts.
> Thanks
> John
>