![]() |
|
|
|
#1
|
|||
|
|||
|
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
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 |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Runtime Error 91 | silentwolf | Word VBA | 2 | 07-23-2017 12:04 AM |
| Excel runtime error 48; error in loading dll | mwittman5 | Excel Programming | 0 | 01-19-2017 05:18 PM |
runtime error 1004
|
gbaker | Excel Programming | 11 | 06-06-2012 05:23 AM |
Runtime error 91
|
waldux | Word VBA | 1 | 03-04-2011 11:25 PM |
| Runtime error 5487 - Word cannot complete the save to to file permission error | franferns | Word | 0 | 11-25-2009 05:35 AM |