Hi guys,
just wondering if someone can help me with this piece of code.
Code:
Sub TableDurchlaufen()
Dim objFolder As Outlook.Folder
Dim objTable As Outlook.Table
Dim objColumn As Outlook.Column
Dim objRow As Outlook.Row
Set objFolder = GetFolderByPath("\\Outlook\Posteingang")
Set objTable = objFolder.GetTable
With objTable
.Columns.Add "SenderEMailAddress"
Do While Not objTable.EndOfTable
Set objRow = .GetNextRow
Debug.Print objRow("EntryID"), objRow("Subject"), objRow("SenderEMailAdress")
Loop
End With
End Sub
Code:
Public Function GetFolderByPath(strPath As String) As Outlook.Folder
Dim objFolder As Outlook.Folder
For Each objFolder In GetMAPI.Folders
If objFolder.FolderPath = strPath Then
Set GetFolderByPath = objFolder
Exit Function
Else
Set GetFolderByPath = GetFolderByPath_Rek(strPath, objFolder)
If Not GetFolderByPath Is Nothing Then
Exit Function
End If
End If
Next objFolder
End Function
Public Function GetFolderByPath_Rek(strPath As String, objParent As Outlook.Folder) As Outlook.Folder
Dim objFolder As Outlook.Folder
For Each objFolder In objParent.Folders
If objFolder.FolderPath = strPath Then
Set GetFolderByPath_Rek = objFolder
Exit Function
Else
Set GetFolderByPath_Rek = GetFolderByPath_Rek(strPath, objFolder)
If Not GetFolderByPath_Rek Is Nothing Then
Exit Function
End If
End If
Next objFolder
End Function
I have got these codes from a book from Andre Minhorst..
But I run into problems with my sub..
On the debug line it returns a runtime Error 5 ..
Invalied Procedure call or argument..
The code works if I am use the first two Column so to speak but once I am using the "SenderEMailAddress" it fails..
Can someone tell me what the problem is?
Many thanks
Albert