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 6: PropertiesExampleThis example schedules a new task and exports the results to an Excelfile.Sub Main()Dim objSchedApp As ObjectDim objNewTask As ObjectSet objSchedApp = CreateObject("CognosBatcher.Application")Set objNewTask = CreateObject("CognosBatcher.Schedule")With objNewTask.ScheduleDescription = "My new exporting task".ScheduleName = "C:\Program Files\Cognos\Impromptu 5.0\" & _"Imp.5.0 Samples\Reports\Annual Product Sales.imr".ScheduleType = 0.RunAtHour = 13.RunAtMin = 20.EffectiveFrom = Date'export the results.ExportAs = True'export the results in Excel format.ExportType = "xls"'must supply a valid path and new file name.ExportFileName = "C:\MyExportFiles\ExcelExport.xls".SaveEnd WithSet objNewTask = NothingSet objSchedApp = NothingEnd SubHasErrors PropertySyntaxCompletedJob.HasErrorsApplies ToCompletedJobDescriptionReturns whether an error was generated when a specific task ran.DiscussionUse this property to determine whether an error was generated during theperformance of the task, and then use the ErrorMessage property toobtain the error message.The values for this property are• True - an error was generated• False - no error was geneartatedTypeBoolean74 <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!