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.
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.
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.
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…
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)