Setting flag follow up for next business day

Status
Not open for further replies.

molonlabe

Member
Outlook version
Outlook 2016 32 bit
Email Account
IMAP
I want to be able to run this macro and instead of just flagging the follow up for the next day, I would like it to set it for the next business day. Can anyone help?



Code:
Sub ForwardFlag()

Call ForwardAttachment
Call Set_FollowUp

End Sub
Sub ForwardAttachment()
  
    Dim MyItem As Object 'original email
    Dim MyFwdItem As MailItem 'forward email
  
    Dim strSub As String 'subject string
    Dim Signature As String 'signature string
    Dim strBody As String
  
    Set MyItem = ActiveExplorer.Selection(1)
  
    If MyItem.Class = olMail Then 'check if mail item is selected
  
        'code to change & manipulate subject of email
        strSub = MyItem.Subject
        strSub = Replace(strSub, "RE: ", "")
        strSub = Replace(strSub, "FW: ", "")
      
        strBody = MyItem.Body
        strBody = "<font size=""3"" face=""calibri"">"
      
        Set MyFwdItem = MyItem.Forward
      
        'code to select signature from default location. if none found it will put signature as blank
        Signature = Environ("appdata") & "\Microsoft\Signatures\" 'default signature location
        If Dir(Signature, vbDirectory) <> vbNullString Then
            Signature = Signature & Dir$(Signature & "*.htm")
            Signature = CreateObject("Scripting.FileSystemObject").GetFile(Signature).OpenAsTextStream(1, -2).ReadAll
        Else:
            Signature = ""
        End If

        'set email parameters
        With MyFwdItem
            .To = ""
            .Subject = strSub
            .HTMLBody = strBody & "<br>" & Signature
            .Display 'replace with .send once your happy it works
            '.Send
        End With
  
        Set MyFwdItem = Nothing
  
    Else
        MsgBox "Select a mailitem and try again"
    End If

    Set MyItem = Nothing
End Sub


Sub Set_FollowUp()

    Dim numDays As Double
    Dim uPrompt As String
    Dim MyMailItem As Object

startDate = Now + 1

    On Error Resume Next
    If ActiveInspector.CurrentItem.Class = olMail Then
        Set MyMailItem = ActiveInspector.CurrentItem
    End If

    If MyMailItem Is Nothing Then
    ' Might be in the explorer window

        If (ActiveExplorer.Selection.Count = 1) And _
          (ActiveExplorer.Selection.Item(1).Class = olMail) Then

            Set MyMailItem = ActiveExplorer.Selection.Item(1)

        End If
    End If

    If MyMailItem Is Nothing Then
        MsgBox "Problem." & vbCr & vbCr & "Try again " & _
         "under one of the following conditions:" & vbCr & _
         "-- You are viewing a single message." & vbCr & _
         "-- You have only one message selected.", _
         vbInformation
        Exit Sub
    End If

    MyMailItem.FlagDueBy = startDate

    ' *** optional code ***
    'uPrompt = "Follow-Up how many days from now? Decimals allowed."
    'numDays = InputBox(prompt:=uPrompt, Default:=1)

    'MyMailItem.FlagDueBy = Now + numDays
    'MyMailItem.FlagRequest = "Customized Follow up"
    ' *** end of optional code ***

    MyMailItem.Save
End Sub
 
This:
startDate = Now + 1
is what needs changed. Outlook doesn't have a next business day function, so you need to use the function here - Create Outlook appointments for every nn workday -

replace that line with

' 65 = skip Sat/Sun
nextDate = Workday2(Date, NumOfDays + 1, 65)
startDate = nextDate

and use the Workday2 Function from that page - and the holiday sub if you want to check your calendar for all day events marked busy and skip them.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
D Setting the Reminder flag in VBA for e-Mails sent to users Outlook VBA and Custom Forms 5
V Setting up Outlook 2021 on new computer Using Outlook 2
AlphonseG Outlook 365 Outlook Crashes on setting SaveSentMessageFolder Outlook VBA and Custom Forms 4
R Outlook 2021 Having problem setting up outlook 2021 with windows 11. I have 3 gmail accounts and I want the 3 gmail, emails to merge into the same outlook input. Using Outlook.com accounts in Outlook 0
e_a_g_l_e_p_i Outlook 2010 Help setting up Gmail account in Outlook 2010 Using Outlook 3
P OWA Settings->Calendar->Events from Email; Setting changes do not hold Using Outlook 1
Marc2019 Setting up an Outlook Account on Mac Os 10.6.8 Outlook 2011 Using Outlook 1
L Outlook Office 365 client: won't remember my setting File, not to collapse ribbon Using Outlook 2
M Where is the setting to *turn off* open calendar in a new window? Using Outlook 3
llama_thumper Setting up forwarders on Exchange server Exchange Server Administration 0
B Setting rules Using Outlook 1
C iCloud Setting missing Outlook tab and Outlook missing the iCloud refresh button Using Outlook 4
B Setting defaults Using Outlook 2
C need help setting up outlook first time Using Outlook 1
P Reading Pane (Reading Pain?) Default Setting Using Outlook 1
W Setting up a custom form Outlook VBA and Custom Forms 2
mctabish Setting "Reply To" based on inbox Outlook VBA and Custom Forms 2
R Setting font and color used when replying to an email Outlook VBA and Custom Forms 3
Ed Sheehan Unusual behaviour in setting Sender (Outlook 2016) Outlook VBA and Custom Forms 4
Jennifer Murphy Equations don't comply with style setting to left justify Using Outlook 0
J Setting default address book Using Outlook 0
N Does a Shared Folder Policy override a Digital Signature Setting for macros? Outlook VBA and Custom Forms 6
Diane Poremsky Setting up an Outlook.com IMAP account Using Outlook 0
Diane Poremsky Setting the default Country for Outlook Contacts Using Outlook 0
H Need help setting up GetFolderPath-Makro with Vodafone IMAP Mail-Account Outlook VBA and Custom Forms 0
Diane Poremsky Adjusting Outlook's Zoom setting in Email Using Outlook 0
O Setting default format for composing/replying to emails Using Outlook 3
B Outlook Calendar/setting appointments Using Outlook 1
Diane Poremsky Adjusting Outlook's Zoom setting in Email Using Outlook 0
Diane Poremsky Setting Custom Reminder Times Using Outlook 0
A Can't stop Outlook.com from setting reminders on appointments? Using Outlook.com accounts in Outlook 3
A Setting RULES with more than one condition in MS OUTLOOK Using Outlook 6
L Setting up my PA's Outlook Using Outlook 7
E Need Help on Setting up a repeated Reminder on Task with Reoccurence Every Year Using Outlook 6
N "Instant Search" setting a default view Using Outlook 3
H SETTING UP A "NEW" NEVER HAD NEVER USED EMAIL ACCOUNT Using Outlook 9
K Setting Default Email Address for Meeting Replies Using Outlook 3
S Setting up Outlook 2010 to work with custom domain outlook.com account BCM (Business Contact Manager) 3
D Setting defult "Show a room list" Using Outlook 0
Horsepower Setting appointments in calendar Using Outlook 3
J Setting tabs in contacts / notes field Using Outlook 0
T Setting a Default Subject from a certain Signature Using Outlook 0
K Help Needed - setting up Email in Outlook 2013 Using Outlook 3
mikecox setting Default area code in Contacts Using Outlook 5
G Outlook2013 - "From" name doesn't change even when changed in Account Setting Using Outlook 4
D How do I start completely from scratch in setting up Outlook 2013? Using Outlook 6
V View zoom setting changing Using Outlook 1
C Setting up Outlook 10 on Widows 8 using Google Server Using Outlook 3
I Outlook Appointments - Setting default text in message body Using Outlook 3
T Setting Color codes for each user of a shared Calendar Using Outlook 1

Similar threads

Back
Top