thefear
Technical User
- Mar 24, 2004
- 20
Hello folks,
I've got a ton of BO reports to schedule in Broadcast Agent (I'm using BO 5.1.4), and I'd like to so by using a bit of VBA. Below is what I have so far, put together from various sources.
It fails on the .ExportAsText line. I know this isn't the correct method to use, and I've tried .SaveAs and .SaveAsText, but they're all just stabs in the dark. Can anyone enlighten me?
Function Submit()
Dim BoApp As busobj.Application
Dim BODoc As busobj.Document
Dim BORep As busobj.Report
Dim DAOpt As DocAgentOption
Dim stNewFileName As String
Set BoApp = CreateObject("BusinessObjects.application")
With BoApp
'log in to BOBJ
'UserName = InputBox("BO Username: ", "Enter Username")
'Password = InputBox("BO Password: ", "Enter Password")
'.LoginAs UserName, Password
.Visible = True
End With
strDocPath = "c:\test3\"
strCurrentFile = Dir(strDocPath & "*.rep")
Do While strCurrentFile <> ""
Set BODoc = BoApp.Documents.Open(strDocPath & strCurrentFile)
'set the BCA options and send to BCA
Set DAOpt = BODoc.DocAgentOption
With DAOpt
.Server = "Scheduler" 'your BCA Scheduler name
.Refresh = True 'refresh the report
.ScheduleMode = boMonthly 'run only once
.StartDate = Date 'start now
.EndDate = DAOpt.StartDate + 365 'must be later than start
.Send
.ExportAsText ("c:\test3\" & Left(strCurrentFile, Len(strCurrentFile) - 3) & "txt")
.Send
End With
BODoc.Close
strCurrentFile = Dir
Loop
End Function
Thanks for looking!
I've got a ton of BO reports to schedule in Broadcast Agent (I'm using BO 5.1.4), and I'd like to so by using a bit of VBA. Below is what I have so far, put together from various sources.
It fails on the .ExportAsText line. I know this isn't the correct method to use, and I've tried .SaveAs and .SaveAsText, but they're all just stabs in the dark. Can anyone enlighten me?
Function Submit()
Dim BoApp As busobj.Application
Dim BODoc As busobj.Document
Dim BORep As busobj.Report
Dim DAOpt As DocAgentOption
Dim stNewFileName As String
Set BoApp = CreateObject("BusinessObjects.application")
With BoApp
'log in to BOBJ
'UserName = InputBox("BO Username: ", "Enter Username")
'Password = InputBox("BO Password: ", "Enter Password")
'.LoginAs UserName, Password
.Visible = True
End With
strDocPath = "c:\test3\"
strCurrentFile = Dir(strDocPath & "*.rep")
Do While strCurrentFile <> ""
Set BODoc = BoApp.Documents.Open(strDocPath & strCurrentFile)
'set the BCA options and send to BCA
Set DAOpt = BODoc.DocAgentOption
With DAOpt
.Server = "Scheduler" 'your BCA Scheduler name
.Refresh = True 'refresh the report
.ScheduleMode = boMonthly 'run only once
.StartDate = Date 'start now
.EndDate = DAOpt.StartDate + 365 'must be later than start
.Send
.ExportAsText ("c:\test3\" & Left(strCurrentFile, Len(strCurrentFile) - 3) & "txt")
.Send
End With
BODoc.Close
strCurrentFile = Dir
Loop
End Function
Thanks for looking!