我正在工作计算机上使用一个代码从outlook中提取项目。代码太长,无法重新键入,我无法在工作计算机上登录到Stack,所以我会在重新键入整件事之前发布我有问题的行,看看这是否是一个简单的解决方案。此外,"代码"适用于收件箱文件夹。但我集成了Skype,我在Skype上的每一次对话都会进入";对话历史";文件夹但我似乎无法将这些导入excel。
工作代码:
Set Folder = OutlookNameSpace.GetDefaultFolder(olFolderInbox)
非工作代码:
Set Folder = OutlookNameSpace.GetDefaultFolder(olFolderConversationHistory)
我尝试了许多不同的变体,但根本无法使其发挥作用。对话历史不被认为是"对话"吗;文件夹";还是我必须用不同的方式把它带进来?
这应该会浏览所有文件夹。
Option Explicit
Private Sub LoopFoldersInStores()
Dim colStores As Stores
Dim oStore As Store
Dim oRoot As Folder
Dim oRootFolders As Folders
Dim i As Long
Set colStores = Session.Stores
For Each oStore In colStores
Set oRoot = oStore.GetRootFolder
Debug.Print
Debug.Print "oRoot.folderPath: " & oRoot.folderPath
Set oRootFolders = oRoot.Folders
Debug.Print " objRootFolders.Count: " & oRootFolders.Count
For i = 1 To oRootFolders.Count
' Not hidden / hidden
Debug.Print i; oRootFolders(i)
If oRootFolders(i) = "Conversation History" Then
Debug.Print " ** Conversation History found **"
'Set ActiveExplorer.currentFolder = oRootFolders(i)
' or
'oRootFolders(i).Display
Exit For
End If
Next
Next
Debug.Print "Done."
End Sub