Hello,
We are looking to give our users the option of emailing BO docs as attachments via BCA – trying to do it using VBA SDK (I know BCA Publisher has this option but we do not have it).
I have tried writing an add-in to enable the user to specify the email addresses (I will install the add-in on the BCA server as well) – but the problem is that how do you pass the email addresses that the user specifies when scheduling the report and then capture them when document runs on the server (one could create a db table to store those addresses but I am looking for a simpler way if possible).
Michael,
The solution you directed me to needs that the code be written in every BO document which needs to be scheduled. We would like to give users an option to schedule any document for email via BCA without us getting involved in writing the code in their documents.
That is why I was looking to create an add-in which would for e.g. prompt them for email addresses – and then when the report runs on the BCA server, access those email addresses to mail the report to. Any ideas?
Klaus,
Could you please share some of your experiences on how to do this? I did not understand the piece about After Refresh() event – the one in the scheduled document or the add-in?
Ideally, users should be able to specify email recipients along with scheduling the report via BCA.
In your solutions, did you keep the recipients in a db table?
Whenever you refresh a document there is a VBA event called “After Refresh” you build an add-in watching for this and which does then send it to e-mail.
Now the trick is how do you define the recipients, lists, message, …
We used many different solutions:
Report Variables
Document Properties
Databases with distribution list
External lists (such as XLS)
…
Again it really depends on how simple or complex you want to build it
I’d be cautious about sending any refreshed document in an AfterRefresh event. We did that for quite some time (without any trouble) and then I ran across the following in the SDK documentation (specifically with the SaveAs Method of the document):
Note: Calling this method from an implementation of the Document event Activate, BeforeRefresh or AfterRefresh could cause an error message to be displayed.
For this reason, I’ve moved all my post-refresh actions into my BeforeClose event.
Also, I’ve developed a BO and matching BCA VBA add-in to do roughly what is described. I have a BO macro that collects “parameters” for the e-mail option (such as recipients, subject line, message body, etc) and stores this info in document detail variables that get saved with the document. There is also a matching e-mail add-in installed on my BCA cluster that checks for the presence of these variables and if found, sends the e-mail.
This is all based on the BO 5.1.6 suite. I also use Blat for the e-mail generation (I’m a believer).