Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng 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
Joined
Feb 8, 2002
Messages
321
Location
BE
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
 
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

Back
Top