Hello,
I am struggling to get my report into the BCA, it has one prompt on Route (eg. ‘New York’) and I need it to be saved in excel for every route eg. New York.xls
I have been searching the forum and managed to find various bits of VBA code and have managed to get it so it goes into the BCA but it fails with the error
1010 The Subroutine is not defined.
Here is my code:
Sub SendToBCAServer()
Dim Vars As Variables
Dim BCA As DocAgentOption
Set doc = ThisDocument
Set Vars = Application.ActiveDocument.Variables
Set BCA = ThisDocument.DocAgentOption
BCA.Server = “vhbca1”
BCA.ScheduleMode = boOnce
BCA.Title = “NRDtest”
BCA.DistributionFolder = “C:\temp”
BCA.StartDate = Now
BCA.EndDate = Now + 365
BCA.Send
Debug.Print "start: " & Now()
ScriptStartTime = Now()
FilePath = Application.ActiveDocument.Path & ""
ParmFile = FreeFile
Open FilePath & “Parameters.txt” For Input As #ParmFile
Do While Not EOF(ParmFile)
BCA.ResetToDefault
Set ReportNameInfo = Application.ActiveDocument.Variables.Add(“reportnamevar”)
Line Input #ParmFile, ReportNameValue
Line Input #ParmFile, ReportDescValue
Line Input #ParmFile, ReportFrequencyValue
Line Input #ParmFile, ReportScheduleHourValue
Line Input #ParmFile, ReportPrompt1Value
Line Input #ParmFile, ReportSeparatorDummy
Debug.Print "Name " & ReportNameValue
Debug.Print "Desc " & ReportDescValue
Debug.Print "Frequency " & ReportFrequencyValue
Debug.Print "Schedule " & ReportScheduleHourValue
Debug.Print "Wkgrp " & ReportPrompt1Value
ReportNameInfo.Value = ReportNameValue
Vars("Route?").Value = ReportPrompt1Value
BCA.Title = ReportDescValue
doc.Refresh
doc.SaveAs ("C:\" & doc.Name & ".xls")
doc.Close
Loop
Debug.Print "time delta: " & DateDiff(“s”, Now(), ScriptStartTime)
Application.Interactive = True
End Sub
Here are the values in my parameter file:
“NRD.rep”
“New Route Download W”
“New York”
1
“NRD.rep”
“New Route Download W”
“Washington”
1
“NRD.rep”
“New Route Download A”
“Antigua”
1
I have never done any VBA code before so I am really struggling, not sure if I even have the format of the parameter file right
Thanks in advance for any help!!!
cheers
Claire
Claire Everitt (BOB member since 2002-09-03)