Regex 5 digits number from Subject Line in MS Outlook

Regex 5 digits number from Subject Line in MS Outlook

By : yb2125
Date : November 22 2020, 10:38 AM
I hope this helps you . I have the following macro. It needs to pull out a 5 digit number from the Subject line from an open Outlook Email. An example of the subject line would be "Thank you. Order:#98512" (without quotes). , Hope this will do what you need.
code :
Sub ShowTitle()
    Dim orderNumber
    Dim orderRegExp As RegExp
    Dim regExVar As String

    ' Takes the email title from the subject line
    regExVar = "Thank you. Order:#98512"

    Set orderRegExp = New RegExp
    ' \s    Match any space character
    ' \S    Match any non-space character
    ' \d    Match any digit
    ' [xyz] Match any one character enclosed in the character set
    ' {}    Specifies how many times a token can be repeated
    ' $     Match must occur at the end of the string

    orderRegExp.Pattern = "[\s\S]\d{4}$"

    If orderRegExp.test(regExVar) Then
        Set orderNumber = orderRegExp.Execute(regExVar)
        'displays in a message box
        MsgBox orderNumber(0).value
    End If
End Sub

Share : facebook icon twitter icon
How to add Outlook toolbar under the subject line?

How to add Outlook toolbar under the subject line?

By : uji moto
Date : March 29 2020, 07:55 AM
help you fix your problem The custom buttons you are creating are meant to be hosted on a CommandBar control for Outlook 2000-2003. You can use the Ribbon designer in your VSTO project to add a custom Ribbon Group to the Message tab (the ID for which is TabNewMailMessage).
Unfortunately, there's no way to inject a custom UI between the message body and the address header. You can use Task Panes and Form Regions but they must go above the header or to the left, right and bottom of the message body.
separting outlook subject line into columns

separting outlook subject line into columns

By : prmartin
Date : March 29 2020, 07:55 AM
help you fix your problem I have the below code that I am trying to modify to split a subject line into to six columns to view in Excel. , I was able to solve the issue
code :
Sub subject2excel() 

Dim olFolder As Outlook.Folder 
Dim olItem As Outlook.MailItem 
Dim olNS As Outlook.NameSpace 
Dim xlApp As Object 
Dim xlWB As Object 
Dim i As Long 
Dim j As Long 
Dim vSubject As Variant 

On Error Resume Next 
Set xlApp = GetObject(, "Excel.Application") 
If Err <> 0 Then 
    Set xlApp = CreateObject("Excel.Application") 
End If 
On Error GoTo 0 'err_Handler
xlApp.Visible = True 
Set xlWB = xlApp.Workbooks.Add 
 'Set Heading
With xlWB.Sheets(1) 
    .Range("A" & 1).Value = "Sender" 
    .Range("B" & 1).Value = "Location" 
    .Range("C" & 1).Value = "LOB" 
    .Range("D" & 1).Value = "Date" 
    .Range("E" & 1).Value = "Shift End Time" 
    .Range("F" & 1).Value = "Requested Leave Time" 
    .Range("G" & 1).Value = "Paid/Unpaid" 
End With 
 'Fill sheet
Set olNS = GetNamespace("MAPI") 
Set olFolder = olNS.PickFolder 
For i = 1 To olFolder.Items.Count 
    Set olItem = olFolder.Items(i) 
    If InStr(1, olItem.Subject, "|") > 0 Then 
        vSubject = Split(olItem.Subject, "|") 
        With xlWB.Sheets(1) 
            .Range("A" & i + 1).Value = olItem.Sender 
            .Range("B" & i + 1).Value = vSubject(0) 
            .Range("C" & i + 1).Value = vSubject(1) 
            .Range("D" & i + 1).Value = vSubject(2) 
            .Range("E" & i + 1).Value = Trim(Mid(vSubject(3), InStr(1, vSubject(3), Chr(58)) + 1)) 
            .Range("F" & i + 1).Value = Trim(Mid(vSubject(4), InStr(1, vSubject(4), Chr(58)) + 1)) 
            .Range("F" & i + 1).HorizontalAlignment = -4152 'align right
            .Range("G" & i + 1).Value = Replace(Trim(Mid(vSubject(5), InStrRev(vSubject(5), Chr(40)) + 1)), Chr(41), "") 
        End With 
    End If 
Next i 
Set olFolder = Nothing 
Set xlApp = Nothing 
Set xlWB = Nothing 
Set olItem = Nothing 
Exit Sub 
GoTo lbl_Exit 
End Sub
Custom Subject line for Outlook

Custom Subject line for Outlook

By : Jake25
Date : March 29 2020, 07:55 AM
wish help you to fix your issue So tempted to leave out the comment but there's still a possibility you will miss it XD
code :
Sub SendReminderMail()

Dim OutLookApp As Object
Dim OutLookMailItem As Object
Dim lastRow As Long
Dim iCounter As Long
Dim MailDest As String
Dim subj As String

lastRow = ThisWorkbook.WorkSheets("Sheet6").Cells(Rows.Count, "D").End(xlUp).Row 'change worksheet

For iCounter = 2 To lastRow

    Set OutLookApp = CreateObject("Outlook.application")
    Set OutLookMailItem = OutLookApp.CreateItem(0)

    With OutLookMailItem
        subj = ""
        MailDest = ""

        If Cells(iCounter, 3) = "Send Reminder" Then
            subj = Cells(iCounter, 6).Value
            MailDest = Cells(iCounter, 4).Value

            .BCC = MailDest
            .SUBJECT = subj
            .Body = "Reminder: Time to contact this firm"
        End If

    End With

Next iCounter

End Sub
VB .NET Outlook 2016 Add-in Subject Line

VB .NET Outlook 2016 Add-in Subject Line

By : lilikandrian
Date : March 29 2020, 07:55 AM
This might help you The important part is that the subject edit box needs to lose focus for the OOM to become aware of the change.
You can use accessibility API or raw Windows API to access the contents of the edit box or you can try to focus some other inspector control, such as the message body editor.
Launch Outlook to compose a message with subject and attachment by Outlook's command line switches

Launch Outlook to compose a message with subject and attachment by Outlook's command line switches

By : Kelvin Meyer
Date : March 29 2020, 07:55 AM
this will help So far from what I've discovered with Outlook 2007 is that in order to achieve this you have to realize that /a implies /c IPM.note.
So using
Related Posts Related Posts :
  • %0 is not replaced by server name when used with Apache's ProxyPassMatch
  • Regular expression for two fields on JSON response - Jmeter
  • Adding to the requirejs optimizer fileExclusionRegExp
  • grep file with full contain string
  • merge two regular expressions in vs2010
  • Get substring up until the first question mark
  • Regular expression to match part of word
  • editing a JSON file with sed
  • R: RegEx for coordinates
  • PERL: Matching multiple patterns
  • Extract location data using regex in R
  • Extracting Dates Using Regular Expression in R using grepl
  • Regex with multiple optional groups
  • Pseudo currency regex
  • Subject to permlink convertion in bash
  • Regular expression replace all occurrences of any word beginning with a certain substring
  • Umbraco 7 regex error: Value is invalid, it does not match the correct pattern
  • Regex using Vala and GLib
  • How to match multi-row data using regular expression R programming
  • Capitalize words in a bash variable using sed
  • Find last 30 occurrences of a string in a log file using Perl
  • How to use regex in bash for selecting a string between double quotes?
  • Golang to match dash(hyphen) character
  • How to express a escape sequence in regex. ("" -> ")
  • Regular Expression - Perl
  • Regex That Pulls Certain Bits From a String
  • Regex: This or that or none
  • Copying text from one line to another
  • find string that consists only of a certain set of characters
  • Sublime Text 3: How to change the notation from ``->cls`` to some macro?
  • VBScript Return an entire line when searching for a string
  • Unwind array of objects mongoDB
  • To delete the last character with regex
  • Understanding negative lookahead
  • How can I exclude a string if it ends in ".d.ts"?
  • Need help regarding forming a regular expression -xml
  • Using sed to replace string in file by using regex capture group
  • How to match a sequence of whitespaces with c++11 regex
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org