Macro to send query to BCA?

Hello all -

I’d like to create a macro that adds a button to my menu bar, that when I click on it, it sends my query to broadcast agent, runs it at a high priority, does a refresh only, and adds my id to the distribution list. Does anybody have any similar code out there to do this? THANKS! -Holly


heket789 (BOB member since 2004-07-19)

Do a search here on BOB, or look in BOB’s Downloads for sample code on building toolbars. As far as the code to send to BCA, this should be close:

Sub SendToBCA()
    Dim BCA As DocAgentOption
    Set BCA = ActiveDocument.DocAgentOption
    BCA.Server = "YourBatchScheduler"
    BCA.Refresh = True
    BCA.Users(1) = Application.Variables("BOUSER").Value
    BCA.Priority = boPriorityHigh
    BCA.Title = ActiveDocument.Name & " - " & Now
    BCA.ScheduleMode = boOnce
    BCA.StartDate = Now
    BCA.EndDate = Now + 1
    BCA.Send
End Sub

You will also need code to fill in any prompts ahead of time, because this approach will not prompt before sending.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

How would I fill the prompt ahead of time? Set a document variable of the prompted variable? That didn’t seem to work and this technique does not prompt the user for prompt variables at the time of the Send method.


dirmiger :us: (BOB member since 2002-08-28)

That’s probably the issue. Prompts are in the Doc.Variables collection, not the Doc.DocumentVariables collection. Check the syntax I suggested in this SDK forum post.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Great piece of Code indeed. Thank you Dwayne !!

I have successfully created some BCA task on this way but remain trouble when using filewatcher. I would like to delete the filewatcher only if task is successfull. While the option is avaiable in interactive mode, I can’t find the way to code it. I have all tried this code with no results. Any idea ? But maybe is it again a new bug…


BCA.FileWatcher.FileWatcherOnly = False
BCA.FileWatcher.DeleteFileOnCompletion = False

Result when editing task : Never delete fw

BCA.FileWatcher.FileWatcherOnly = True
BCA.FileWatcher.DeleteFileOnCompletion = True

Result when editing task : delete at each task startup

BCA.FileWatcher.FileWatcherOnly = True
BCA.FileWatcher.DeleteFileOnCompletion = False

Result when editing task : Never delete fw

BCA.FileWatcher.FileWatcherOnly = False
BCA.FileWatcher.DeleteFileOnCompletion = True

Result when editing task : delete at each task startup

BCA.FileWatcher.DeleteFileOnCompletion = True

Result when editing task : delete at each task startup

BCA.FileWatcher.DeleteFileOnCompletion = False

Result when editing task : Never delete fw

BCA.FileWatcher.FileWatcherOnly = True

Result when editing task : Never delete fw

BCA.FileWatcher.FileWatcherOnly = False

Result when editing task : Never delete fw


bernard timbal :fr: (BOB member since 2003-05-26)