11.07.2015 Views

Automate Scheduler Using Macros

Automate Scheduler Using Macros

Automate Scheduler Using Macros

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 5: MethodsExampleThis example displays all scheduled tasks and enables the user to deletethem.Sub Main()Dim objSchedApp As ObjectDim objScheduledTasks As ObjectDim intCounter As IntegerDim strTaskDescription As StringSet objSchedApp = CreateObject("CognosBatcher.Application")Set objScheduledTasks = objSchedApp.Schedules'This loop will start at the bottom of the list of tasksFor intCounter = objScheduledTasks.Count To 1 Step -1With objScheduledTasks.Item(intCounter)strTaskDescription = .ScheduleDescriptionintResponse = MsgBox("Delete this task?" & chr(13) & _strTaskDescription, 292, "Scheduled Task " & Str(intCounter))If intResponse = 6 Then'The Delete method will remove the specified task from the'the list of scheduled tasks. ContinueOnError parameter is'true, so user will not be notified if deletion of a'server task results in an error..Delete (True)End IfEnd WithNext intCounterSet objScheduledTasks = NothingSet objSchedApp = NothingEnd Sub30 <strong>Automate</strong> <strong>Scheduler</strong> <strong>Using</strong> <strong>Macros</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!