Excel에서 매크로를 작성하여 특정 공유 Outlook 메일 폴더의 항목 수를 계산하여 Excel에서 계산합니다.Outlook에서 항목 수 계산을위한 Excel 매크로 날짜순 공유받은 편지함
지금까지 개인받은 편지함 (사서함 검색을위한 다른 코드)에서 작업 할 수 있었고 공유 사서함 폴더에 액세스하여 총 항목 수를 확인할 수있었습니다 (아래 코드를 사용하여 사서함 검색).
지금 내 문제는 런타임 오류 '438'입니다. 개체가이 속성이나 메서드를 지원하지 않습니다.
iCount를 사용하는 코드의 배열 섹션까지 추적했습니다.
코드에 대한 참조 또는 도움을 얻을 수있는 방향에 대한 정보는 크게 감사하겠습니다.
Sub HowManyDatedEmails()
' Set Variables
Dim EmailCount As Integer, DateCount As Integer, iCount As Integer
Dim myDate As Date
Dim arrEmailDates()
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olFldr As Outlook.MAPIFolder
Dim olItem As Object
Dim olMailItem As Outlook.MailItem
'Call Folder
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olFldr = olNS.Folders("delivery quality team")
Set olFldr = olFldr.Folders("Inbox")
' Put ReceivedTimes in array
EmailCount = olFldr.Items.Count
For iCount = 1 To EmailCount
With olFldr.Items(iCount)
ReDim Preserve arrEmailDates(iCount - 1)
arrEmailDates(iCount - 1) = DateSerial(Year(.ReceivedTime), Month(.ReceivedTime), Day(.ReceivedTime))
End With
Next iCount
' Clear Outlook objects
Set olFldr = Nothing
Set olNS = Nothing
Set olApp = Nothing
' Count the emails dates equal to active cell
Sheets("Count_Data").Range("A2").Select
Do Until IsEmpty(ActiveCell)
DateCount = 0
myDate = ActiveCell.Value
For i = 0 To UBound(arrEmailDates) - 1
If arrEmailDates(i) = myDate Then DateCount = DateCount + 1
Next i
Selection.Offset(0, 1).Activate
ActiveCell.Value = DateCount
Selection.Offset(1, -1).Activate
Loop
End Sub
이것은 모두 훌륭한 정보입니다. 새로운 방법을 사용하여 나중에 더 효율적으로 다시 작성합니다. 고맙습니다. – Cgitlin