ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Email VB not working (https://www.excelbanter.com/excel-discussion-misc-queries/127819-email-vbulletin-not-working.html)

tankerman

Email VB not working
 
I have this VB in my workbook

Sub eMailActiveWorkbook()

Dim OL As Object
Dim EmailItem As Object
Dim Wb As Workbook

Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Wb = ActiveWorkbook
Wb.Save
With EmailItem
.Subject = "Big Sandy Docks"
.Body = "Wells Weekly Report" & vbCrLf & _
"" & vbCrLf & _
""
.To = "Wells"
.Importance = olImportanceNormal
.Attachments.Add Wb.FullName
.Display
End With

Application.ScreenUpdating = True

Set Wb = Nothing
Set OL = Nothing
Set EmailItem = Nothing

End Sub

and it works great except for one little detail, there are several of us on
a shared drive that updates this workbook, when ever we try to email this
workbook to the distribution list the workbook freeze up and I get the
message that the workbook is not responding and must close (I have a button
to send), but it works great if I drag the workbook to my desktop, open it,
click the button and it works great. What am I going to have to do if
anything.

tankerman

Email VB not working
 
the problem was with our email system not with the VB which now works great.

"tankerman" wrote:

I have this VB in my workbook

Sub eMailActiveWorkbook()

Dim OL As Object
Dim EmailItem As Object
Dim Wb As Workbook

Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Wb = ActiveWorkbook
Wb.Save
With EmailItem
.Subject = "Big Sandy Docks"
.Body = "Wells Weekly Report" & vbCrLf & _
"" & vbCrLf & _
""
.To = "Wells"
.Importance = olImportanceNormal
.Attachments.Add Wb.FullName
.Display
End With

Application.ScreenUpdating = True

Set Wb = Nothing
Set OL = Nothing
Set EmailItem = Nothing

End Sub

and it works great except for one little detail, there are several of us on
a shared drive that updates this workbook, when ever we try to email this
workbook to the distribution list the workbook freeze up and I get the
message that the workbook is not responding and must close (I have a button
to send), but it works great if I drag the workbook to my desktop, open it,
click the button and it works great. What am I going to have to do if
anything.



All times are GMT +1. The time now is 02:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com