+ Reply to Thread
Results 1 to 5 of 5

Use VBA in Excel to add automatic 2 week reminder from start date in Outlook

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-02-2010
    Location
    Northumberland, England
    MS-Off Ver
    Excel 2016
    Posts
    143

    Use VBA in Excel to add automatic 2 week reminder from start date in Outlook

    Hi

    Id like to add a 2 week reminder (20160 minutes) into this code onlt if there is a date in the start column (col 9). Is this at all possible. Ive tried adding a default 20160 value in The reminder column of my spreadsheet but its add reminders to all 268 rows. Thanks in advance

    Private Sub CommandButton1_Click()
    If Not ThisWorkbook.Name = "LD TOOL v2.xlsm" Then
    ' Create the Outlook session
        Set myOutlook = CreateObject("Outlook.Application")
    
        ' Start at row 5
        r = 6
    Application.ScreenUpdating = False
        Do Until Trim(Cells(r, 1).Value) = ""
            ' Create the AppointmentItem
            Set myApt = myOutlook.createitem(1)
            ' Set the appointment properties
            myApt.Subject = Cells(r, 1).Value
            myApt.Start = Cells(r, 9).Value
            myApt.Location = Cells(r, 10).Value
            myApt.Duration = Cells(r, 11).Value
            ' If Busy Status is not specified, default to 2 (Busy)
            If Trim(Cells(r, 12).Value) = "" Then
                myApt.BusyStatus = 2
            Else
                myApt.BusyStatus = Cells(r, 12).Value
            End If
            If Cells(r, 13).Value > 0 Then
                myApt.ReminderSet = True
                myApt.ReminderMinutesBeforeStart = Cells(r, 13).Value
            Else
                myApt.ReminderSet = False
            End If
            myApt.Body = Cells(r, 14).Value
            myApt.Save
            r = r + 1
        Loop
        Application.ScreenUpdating = True
    End If
    End Sub
    Regards

    SB
    Last edited by singerbatfink; 02-11-2016 at 07:28 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,094

    Re: Use VBA in Excel to add automatic 2 week reminder from start date in Outlook

    Maybe:

    Option Explicit
    
    Private Sub CommandButton1_Click()
    If Not ThisWorkbook.Name = "LD TOOL v2.xlsm" Then
    ' Create the Outlook session
        Set myOutlook = CreateObject("Outlook.Application")
    
        ' Start at row 5
        r = 6
    Application.ScreenUpdating = False
        Do Until Trim(Cells(r, 1).Value) = ""
            If Cells(r, 9).Value <> "" Then
                ' Create the AppointmentItem
                Set myApt = myOutlook.createitem(1)
                ' Set the appointment properties
                myApt.Subject = Cells(r, 1).Value
                myApt.Start = Cells(r, 9).Value
                myApt.Location = Cells(r, 10).Value
                myApt.Duration = Cells(r, 11).Value
                ' If Busy Status is not specified, default to 2 (Busy)
                If Trim(Cells(r, 12).Value) = "" Then
                    myApt.BusyStatus = 2
                Else
                    myApt.BusyStatus = Cells(r, 12).Value
                End If
                If Cells(r, 13).Value > 0 Then
                    myApt.ReminderSet = True
                    myApt.ReminderMinutesBeforeStart = Cells(r, 13).Value
                Else
                    myApt.ReminderSet = False
                End If
                myApt.Body = Cells(r, 14).Value
                myApt.Save
                r = r + 1
            End If  'Cells(r, 9).Value <> ""
        Loop    'Trim(Cells(r, 1).Value) = ""
        Application.ScreenUpdating = True
    End If
    End Sub

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    03-02-2010
    Location
    Northumberland, England
    MS-Off Ver
    Excel 2016
    Posts
    143

    Re: Use VBA in Excel to add automatic 2 week reminder from start date in Outlook

    Hi TMS,

    Thansk for your help, It has put the date in outlook but not a reminder of 2 weeks. Excel is not responding and i have an egg timer conatantly, Could it be the loop?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,094

    Re: Use VBA in Excel to add automatic 2 week reminder from start date in Outlook

    Yes, my fault. Move the End If up a row, before the line that says r = r + 1.

    Sorry.

    Regards, TMS

  5. #5
    Forum Contributor
    Join Date
    03-02-2010
    Location
    Northumberland, England
    MS-Off Ver
    Excel 2016
    Posts
    143

    Re: Use VBA in Excel to add automatic 2 week reminder from start date in Outlook

    Hi TMS,

    Thats great. Do I add the defalt time in this line? (Im a relative vba newbie but getting there)
    If Cells(r, 9).Value <> "" Then
    Last edited by singerbatfink; 02-10-2016 at 10:21 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Automatic Outlook mail due date reminder based on Excel file
    By iamitp in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-18-2019, 05:51 PM
  2. Need VB script for saving an excel file that appends the start of week date
    By alexgempesaw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2014, 03:04 AM
  3. [SOLVED] Set Outlook reminder from Excel cell date. Office 2013
    By Peterino in forum Excel General
    Replies: 1
    Last Post: 10-22-2014, 05:41 PM
  4. Create Outlook Reminder on Excel and transfered to outlook by macro
    By Benjamin2008 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-21-2013, 03:23 PM
  5. Sheets for every week + start and ending date of the week
    By wimexcel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-30-2012, 01:48 PM
  6. Excel 2007 : Date reminder email to Outlook
    By coughandcath in forum Excel General
    Replies: 2
    Last Post: 02-09-2011, 11:18 AM
  7. week start date and end date based on week number
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2009, 12:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1