Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Sub routine 1

Status
Not open for further replies.

Councilk

MIS
May 14, 2003
72
US
Hello, can anyone tell me why I get "Invalid property" when I try to create and call a sub-routine?

Thanks...
 
Hello, this is the section where I build scripts in a Custom IDE. I pull and action like delete file and the tool adds the corresponding lines of code.

However, I need to tweak this code in order to perform an execute actoin twice.

===========================================================
Sub ExecutePowerUser(Pub, Act)
Act.ReturnValue = 0
exe = "C:\Windows\Notepad.exe"
args = ""
wait = TRUE

WriteLog("Executing "exe)

retVal = RunCommand(exe, args, wait)

WriteLog(error executing "&exe& "args")
writelog("retval: "&retval)
StopServices = False

Enf If

End sub

Sub ExecutePowerUser2(Pub, Act)

Act.ReturnValue = 0
exe = "C:\Windows\Some other.exe"
args = ""
wait = TRUE

WriteLog("Executing "exe)

retVal = RunCommand(exe, args, wait)

WriteLog(error executing "&exe& "args")
writelog("retval: "&retval)
StopServices = False

Enf If

End sub

===========================================================

Thanks!
 
You have several syntax error :
End If without corresponding If
Literal constant quoting and lack of concatenation operator

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
why the need to for 2 sub routines? they both look the same? (well aside from the slightly different exe call) just pass the exe you want to call and the parameters you want to call etc to your one sub routine
 
Thanks Mr Movie, the prior comments I understand, I just typed a quick code block to show how it was constructed.

I passed the new arguments in the second sub routine to the function.

I listed new args in the sub2 and called that routine from the sub1.

Both routines used the same function, passing their arguments and it worked just fine.

I'll get more programming classes when I enroll next month.

Up until now I've been teaching myself and following some books on coding.

Thanks all....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top