Posts Tagged ‘VBA’

Outlook VBA: Reply to All as Text

Tuesday, May 24th, 2011

I am a messaging old-timer, going back to the days of PINE and ELM and RBBSMail.  I like to reply to message like this:

>You said
I reply.

Actually the old days the mail client did it by initials so it looked like this:

YS>You said
AK>I reply.

I get a lot of HTML mail, which I see a a waste of storage. I reply as text with the the following code:

Sub ReplyAsText()
    Dim rply As Outlook.MailItem
    Dim item As Outlook.MailItem
    Dim retval As Integer
   
    Set item = GetCurrentItem()
    item.BodyFormat = olFormatPlain
   
    retval = MsgBox("Reply to all as text? No is just sender.", _
    vbYesNoCancel + vbQuestion + vbSystemModal, _
    "Reply to All?")
   
    If retval = vbCancel Then Exit Sub
   
    If retval = vbYes Then
        Set rply = item.ReplyAll
    Else
        Set rply = item.Reply
    End If
   
    rply.Display

    item.Close olDiscard

    Set rply = Nothing
    Set item = Nothing
End Sub
									

Outlook VBA: Snooze until one minute prior to start

Tuesday, May 24th, 2011

I spend a lot of time on the phone for conference calls.  If I snooze until 5 minutes before I am too early.  0 minutes before and I am too late.  The following is VBA code to snooze open reminders until one minute prior to starting.  I put it into a module and mapped it to a button.

Sub SnoozeUntilOneMinute()
‘Delays all visible reminder until one minute before start

    Dim olApp As Outlook.Application
    Dim objRems As Outlook.Reminders
    Dim objRem As Outlook.Reminder
    Dim varTime As Variant

    Set olApp = New Outlook.Application
    Set objRems = olApp.Reminders
 
    For Each objRem In objRems
        If objRem.IsVisible = True Then
            varTime = DateDiff(“n”, Now(), objRem.item.Start) – 1
            objRem.Snooze (varTime)
            MsgBox “Snoozed ” & objRem.item.Subject & ” for ” & CStr(varTime) & ” minutes.”, vbApplicationModal + vbOKOnly + vbInformation, “Snooze”
        End If
    Next objRem

End Sub