Macro not running when click on Data Refresh at report

Hi I do have one report with macro which is suppose to run after reprot refresh. I have put document_afterrefresh.

When i manually go to vb editor and run the macro…it is runnign fine… but when i will close the vb editor and click on data refresh – it is going to macro but when it is reachign to the point where it is calling another sub procedure that is located in Module1 and defined as public… it is hanging.

I have put email sending stuff in module1 macro… I need to call it again and again./…so i keep it there separately…

Pls help me…


045331 (BOB member since 2004-01-23)

This is the email code

Public Sub EmailSend(Body As String, Subject As String, LogFilePathName As String, MailTo As String)
'objTextStream.WriteLine (“Called Email Function.” & vbCrLf)
'Please enter sender’s e-mail address.
MailFrom = “r00102472@mail.ad.ge.com

'Please enter receiver’s e-mail address.
'Use semicolon between names in the receiver list.
'MailTo = “Manoj.mkumar@ge.com” & “;” & “Paul.x.welch@ge.com” & “;” & “anupama.iyer@ge.com
'MailTo = “Anupama.Iyer@ge.com
'MailTo = “Manoj.mkumar@ge.com

'Please enter e-mail message.
'Body = “The Process has Failed.”
'Subject = “Error Reported in Process”
Dim SafeMail As Variant
Set OlkApp = CreateObject(“Outlook.Application”)
Set NewMail = OlkApp.CreateItem(olMailItem)
Set SafeMail = CreateObject(“Redemption.SafeMailItem”) ‘’
Set SafeMail.Item = NewMail ‘’

Set Attachments = NewMail.Attachments
'PromptDialog.Hide
Attachments.Add (LogFilePathName)
With SafeMail
.To = MailTo
.Body = (Body & vbCrLf & vbCrLf)
.Subject = Subject
.Importance = 1
.Send
End With

Set OlkApp = Nothing

When I click on pause all the time, it is hanging at Set SafeMail = CreateObject(“Redemption.SafeMailItem”) ‘’


045331 (BOB member since 2004-01-23)