Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autosend emails?

Status
Not open for further replies.

FrenchCAD

Mechanical
Feb 8, 2002
321
I'm getting mad trying to make this. I can't get it working :

Private Sub App_WorkbookBeforeClose()
Dim Message
ActiveWorkbook.HasRoutingSlip = True
With ActiveWorkbook.RoutingSlip
.Delivery = xlAllAtOnce
.Recipients = Array("user1@mail", "user2@mail", "user3@mail")
.Subject = "Test"
.Message = "wooohoooo, it works"
End With
ActiveWorkbook.Route
If ActiveWorkbook.HasRoutingSlip And Not ActiveWorkbook.Routed Then
Message = MsgBox("Mail not sent", vbOKOnly, "Error")
ActiveWorkbook.Route
End If
ActiveWorkbook.Save
End Sub

Cyril Guichard
Mechanical Engineer
 
Replies continue below

Recommended for you

Strangely, I have the macro running fine into Workbook_Open() but not into WorkbookBeforeClose()

Also, the HasRoutingSlip method automatically sends the excel file, which I don't want to do. Is there a way to bypass this?

Cyril Guichard
Mechanical Engineer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor