Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-02-2018, 04:02 AM
silentwolf silentwolf is offline Outlook Table Object Runtime Error 5 Windows 7 64bit Outlook Table Object Runtime Error 5 Office 2010 64bit
Novice
Outlook Table Object Runtime Error 5
 
Join Date: Dec 2016
Location: Austria
Posts: 16
silentwolf is on a distinguished road
Default Outlook Table Object Runtime Error 5

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
Reply With Quote
Reply



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
Outlook Table Object Runtime Error 5 runtime error 1004 gbaker Excel Programming 11 06-06-2012 05:23 AM
Outlook Table Object Runtime Error 5 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

Other Forums: Access Forums

All times are GMT -7. The time now is 02:31 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft