• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA - Auto Email from Cell Value

One final question / help. now that i have use this code and its now in practice.
The idea is that as soon as the workbook is opened it will send emails with all projects with today's date (works great).

Is the something i could add to like an If <Code> so that if Main1 + Main2 doesn't find any data (no emails being sent today) that it will run main3 (which stated that there is no projects due for follow up today. If attached code that i currently have but as i have used (If Macro = Error Then) even if one sheet has no data then it will still run, whereas i only want it to run if both Main1 + main2 do not send email.

Code:
Sub Auto_open()

Dim Answer As String
Dim Answer2 As String

Answer = Msgbox("Do you manage this File? You are about to send daily update emails, are you sure?", vbYesNo + vbQuestion, "Sales Sheet")

If Answer = vbNo Then

Answer2 = Msgbox("This Sales Sheet will now close!", vbOKOnly + vbQuestion, "Closing Sales Sheet!")
    ActiveWorkbook.Close savechanges:=False
Else

GoTo Run
     
Run:
Run (Macro)
  Main1
  Main2
 
If Macro = Error Then
    GoTo Main3:
Else: GoTo Final:
End If
Main3:
Run Macro
    Main3
Final:
  Msgbox ("Project emails have been sent")
  End If
End Sub
 
Back
Top