|
© Matti Mattila, CPFA, CISA, CIA |
CCAS - A macro that calls other macros
|
|
|
Calling other macros.
A macro can call other macros with "Client.RunIDEAScript Filename"
(Filename = full name of the macro to be run, e.g. "M02.iss").
|
|
The macro source code.
The macro below does the following:
declares a variable, sets path to working folder;
checks whether there is "01" (success code) on the first line of "C:\IDEA\CCAS\LRun.txt";
and if that's the case then the next macro in turn is run.
Option Explicit 'All variabales must be declared
DIM Path2 as String 'Path2: Path of the files to be used/created
Sub Main
Path2="C:\IDEA\CCAS\"
Client.RunIDEAScript Path2 & "M01.iss" '.. and "M01" sets "00" or "01" in "LRun.txt"
if F01Chk(Path2 & "LRun.txt")="01" then Client.RunIDEAScript Path2 & "M02.iss"
if F01Chk(Path2 & "LRun.txt")="01" then Client.RunIDEAScript Path2 & "M03.iss"
if F01Chk(Path2 & "LRun.txt")="01" then Client.RunIDEAScript Path2 & "M04.iss"
'If "01" exists on the 1st line in "LRun.txt" -> "M02", "M03", "M04" will be run
'"M02", "M03" update "LRun.txt" to tell whether the next macro is to be run or not
End Sub
Function F01Chk (ByVal File as String) '******************** BEGIN ********************
Open File For Input As #9 'Function "F01Chk" reads the string ("00"/"01")
Input #9, F01Chk 'on the 1st line of "LRun.txt" and brings its to Sub Main
close #9 'Thereafter "LRun.txt" is closed
End Function '******************** END ********************
| | Picture 1 |
|
|
|