+ Reply to Thread
Results 1 to 2 of 2

Outlook Folder Categories

  1. #1
    Registered User
    Join Date
    03-07-2019
    Location
    Jacksonville
    MS-Off Ver
    2016
    Posts
    33

    Outlook Folder Categories

    I have a database of all the outlook folders our team shares. It imports the received date, modified date and many other columns. Our team uses categories in Outlook to show who worked on an email. How can I have access import the categories column from Outlook. Also, how to you import the Flag Completed Date if possible.

  2. #2
    Registered User
    Join Date
    03-07-2019
    Location
    Jacksonville
    MS-Off Ver
    2016
    Posts
    33

    Re: Outlook Folder Categories

    solved using excel not access

    [CODE][/Public Sub CopyMailtoExcel()
    Dim objOL As Outlook.Application
    Dim objFolder As Outlook.Folder
    Dim objItems As Outlook.Items
    Dim olItem As Object ' MailItem
    Dim strDisplayName, strAttCount, strBody, strDeleted As String
    Dim strReceived As Date
    Dim rCount As Long

    ' On Error GoTo Err_Execute
    Application.ScreenUpdating = False

    'Find the next empty line of the worksheet
    rCount = Range("A" & Rows.Count).End(-4162).Row
    rCount = rCount + 1

    Set objOL = Outlook.Application

    ' copy mail to excel
    Set objFolder = objOL.ActiveExplorer.CurrentFolder
    Set objItems = objFolder.Items

    For Each olItem In objItems
    strAttCount = ""
    strBody = ""

    If olItem.Attachments.Count > 0 Then strAttCount = "Yes"

    'On Error Resume Next
    'collect the fields
    strBody = olItem.Body

    ' Remove this block if you don't want to remove the hyperlinked urls
    Dim Reg1 As RegExp
    Dim Match, Matches
    Set Reg1 = New RegExp

    ' remove hyperlinks from bodies for easier reading.
    With Reg1
    .Pattern = "<[src|http|mailto](.*)>(\s)*"
    .Global = True
    .IgnoreCase = True

    .MultiLine = True

    End With

    If Reg1.Test(strBody) Then
    strBody = Reg1.Replace(strBody, "")
    End If
    ' end remove hyperlinks block


    strBody = Trim(strBody)
    strReceived = olItem.ReceivedTime
    strSender = olItem.SenderName

    ' column / field
    ' A Date
    ' B Time
    ' C Attachments (Yes)
    ' D Subject
    ' E Body
    ' F From (display name)
    ' G To (display name)
    ' H CC (display name)
    ' I BCC (sent items only)

    'write them in the excel sheet
    Range("A" & rCount) = strReceived ' format using short date
    Range("B" & rCount) = strReceived 'format using time
    Range("C" & rCount) = olItem.Categories
    Range("D" & rCount) = olItem.Subject
    Range("E" & rCount) = strBody
    Range("F" & rCount) = strSender
    Range("G" & rCount) = olItem.To
    Range("H" & rCount) = olItem.CC
    Range("I" & rCount) = olItem.BCC


    'Next row
    rCount = rCount + 1
    Next


    ' Basic Formatting
    Columns("A:I").Select
    With Selection
    .WrapText = True
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlTop
    .Columns.AutoFit
    End With
    Columns("E:E").Select ' body column
    With Selection
    .ColumnWidth = 150
    .Rows.AutoFit
    End With

    Range("A1:I1").Select
    With Selection
    .VerticalAlignment = xlBottom
    .WrapText = False
    .RowHeight = 55
    End With


    ' Date and Time
    Columns("A:A").Select
    Selection.NumberFormat = "[$-409]ddd mm/dd/yy;@"
    Range("B:B").Select
    Selection.NumberFormat = "[$-F400]h:mm AM/PM"

    Range("D:D").Select
    Selection.ColumnWidth = 20



    Range("A2").Select

    Application.ScreenUpdating = True
    Set olItem = Nothing
    Set objFolder = Nothing
    Set objOL = Nothing
    Set Reg1 = Nothing

    MsgBox "Email import complete"

    Exit Sub

    Err_Execute:
    MsgBox "An error occurred."

    End Sub
    CODE]

+ 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. Replies: 1
    Last Post: 08-21-2018, 01:48 PM
  2. Copying outlook 2013 categories
    By asokaw in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 11-09-2015, 12:46 AM
  3. Copy all emails in outlook folder and paste them in similar system folder and ms access
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-28-2014, 07:31 AM
  4. Replies: 1
    Last Post: 10-18-2014, 05:04 PM
  5. Outlook Strips off Categories when sending email
    By noddy in forum Outlook Formatting & Functions
    Replies: 3
    Last Post: 07-21-2014, 08:04 PM
  6. Replies: 1
    Last Post: 05-15-2013, 06:55 AM
  7. How to locate a new outlook folder
    By Jamie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2005, 02:05 PM

Tags for this Thread

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