BusinessObjects Board

Save as pdf and send it through Outlook as an Attachment

Listers

I have a requirement here where in I have to send the report as a PDF to the users .

I have done the following

I have the following vba macro inside the document in the AfterRefresh Event

[Edit by Eileen to put in BBcode]

Sub Document_AfterRefresh()
  
On Error GoTo Err_Write
  Dim doc As Document
  Dim i As Integer
  
  Set doc = ActiveDocument

' Export as pdf
   doc.ExportAsPDF (doc.Path & "\" & doc.Name & ".pdf")

' Set up Outlook Application

  Set olkapp = CreateObject("Outlook.Application")
  Set NewMail = olkapp.CreateItem(olMailItem)
  Set Attachments = NewMail.Attachments

' Add the attchment

  Attachments.Add (doc.Path & "\" & doc.Name & ".pdf")

' Email Id's

  With NewMail
   'Enter all email addresses in here...
    .To = "bondrea@novachem.com"
    .Body = ""
    .Subject = doc.Name & " has been refreshed and is attached."
    .Importance = 2
    
 ' Send the doc
        .Send
        
        
  End With
  
Err_Write:
 Open "C:\test1.dat" For Append Access Read Write As #1
Write #1, Err.Description
Close #1
Resume Next

  
  MsgBox (doc.Name & " has been sent")

End Sub

When I now refresh the document from my machine , the document gets sent as a PDF to the user

But

When I send the same document to the BCA , the document is not sent to the user

(The reason for this is that the Microsoft Outlook should be located on the same server as the BCA)

But with the Existing Setup how effectively can we do this?

If we send lot of reports though emails , would the regular network traffic be affected? Please explain the PROS AND CONS…

BCA Publisher :

We do not have publisher as of now.
I guess BCA publisher by itslef could send reports/ attachements to user’s inbox without any custom vba macros.


r_kishore (BOB member since 2002-08-20)

Yup, and the same thing is true even if you use Publisher, I believe. If you don’t have an email client on your BCA box, then you can’t send email.

There’s a simple SMTP command line emailer called “blat” as an alternative. The URL that I have is http://www.interlog.com/~tcharron/blat.html

On the other hand, if your admins won’t let you install Outlook, they may not be likely to let you install this either. :wink:

Dave


Dave Rathbun :us: (BOB member since 2002-06-06)

Thanks !

So we need to Install Blat Software on the BCA server . Is it a freeware? Is it the standard way of emailing thru BCA? Are there any workarounds?


r_kishore (BOB member since 2002-08-20)

First of all, your code will not work with BCA even if you have outlook installed on server.You need to create MAPI object in place of outlook object for this to work in BCA.You can download my code from integra’s website by Clicking Here.
You can use CDO object library in place of Mapi also and there was some code available at listserv archive. Search there.

In case you decide to use BLAT, its a simple smtp client, a freeware and works very well…convince your admins tfor that.


dcdas :us: (BOB member since 2002-06-17)

Durgesh: do you have any objection to me putting your code into the “code library” here on Bob?

Dave


Dave Rathbun :us: (BOB member since 2002-06-06)

No objection whatsoever…Thanks


dcdas :us: (BOB member since 2002-06-17)

Moving this topic to the SDK forum since it’s about VBA coding


Bob (BOB member since 2002-06-06)

Hi, Durgesh:

I tried to use the code, but I keep getting the message “Path Not Found”. Could you please tell me why? I didn’t use the \C:, but still saying sth. wrong about the path.

Thanks a lot.

Lilly


Lilly J (BOB member since 2002-08-22)

Has anybody tried to do this type of thing with Lotus Notes? I’m not too familiar with the “inner workings” of Lotus Notes…but I need to do this at a client who uses Notes…


Eileen King :us: (BOB member since 2002-07-10)

Oops!!! By searching I found a lot of answers to this… :oops:


Eileen King :us: (BOB member since 2002-07-10)

I have some problems with this code. When I run it (from BO) a message box appears asking me for permission to access email addresses and another message box asking me for permission to send the email. What’s happening? Any workarounds? (the code seems to be failing on the BCA server)


JornGH (BOB member since 2003-02-21)

Using Outlook, aren’t you? CDONTS?


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

I solved the whole issue by using blat. Works like a charm :slight_smile:


JornGH (BOB member since 2003-02-21)

I agree. Good product for our needs.


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