Microsoft
Software
Hardware
Network
Question : Excel VBA read an Outlook folder into Excel
I have the following Excel code which works fine for importing the Subject and Date Stamp of the items in my Inbox. I want to modify it to import from a sub-folder in my Inbox called "Tickets". Is there any way to do this?
Sub ListAllItemsInInbox()
Dim OLF As outlook.MAPIFolder, CurrUser As String
Dim EmailItemCount As Integer, I As Integer, EmailCount As Integer
Application.ScreenUpdating
= False
Sheets("Sheet1").Select
Cells.Clear
Range("A1").Select
' add headings
Cells(1, 1).Formula = "Subject"
Cells(1, 2).Formula = "Recieved"
With Range("A1:B1").Font
.Bold = True
.Size = 14
End With
Application.Calculation = xlCalculationManual
Set OLF = GetObject("", "Outlook.Application").Get
Namespace(
"MAPI").Ge
tDefaultFo
lder(olFol
derInbox)
EmailItemCount = OLF.Items.Count
I = 0: EmailCount = 0
' read e-mail information
While I < EmailItemCount
I = I + 1
If I Mod 50 = 0 Then Application.StatusBar = "Reading e-mail messages " & Format(I / EmailItemCount, "0%") & "..."
With OLF.Items(I)
EmailCount = EmailCount + 1
Cells(EmailCount + 1, 1).Formula = .Subject
Cells(EmailCount + 1, 2).Formula = Format(.ReceivedTime, "mm/dd/yyyy hh:mm")
End With
Wend
Application.Calculation = xlCalculationAutomatic
Set OLF = Nothing
End Sub
Answer : Excel VBA read an Outlook folder into Excel
Hi, malcolm29.
That's simple. Change this line of code
Set OLF = GetObject("", "Outlook.Application").Get
Namespace(
"MAPI").Ge
tDefaultFo
lder(olFol
derInbox)
to
Set OLF = GetObject("", "Outlook.Application").Get
Namespace(
"MAPI").Ge
tDefaultFo
lder(olFol
derInbox).
Folders("T
ickets")
Random Solutions
What does IPv6 have in store for us, will we have any trouble talking to remote sites?
Need to convert lotusscript to work with macintosh
binding data in aspx from sql data source
Microsoft Access: Creating a payment system.
vCenter Converter and SBS2008
SSRS Report Speed issue
Is this BIOS-setting correct?
how to permanently delete wireless profiles
Outlook in "safe mode"
excel vba to save worksheet as mht file