PDA

View Full Version : Object could not be found



stevenab
09-30-2011, 08:36 AM
Hello,

I am trying to set up Killian's "Automatically save and print attachments" script. I'd link, but this is my first post.

So far I am getting the Object could not be found error message, and when I go to debug, the Set TargetFolderItems line is highlighted. My target folder is located under Inbox\Reports\Daily Transaction Files.

Any ideas? Any help would be greatly appreciated. Here is my code:

'########################################################################## #####
'### this is the Application_Startup event code in the ThisOutlookSession module
Private Sub Application_MAPILogonComplete()
'some startup code to set our "event-sensitive" items collection
Dim ns As Outlook.NameSpace
'
Set ns = Application.GetNamespace("MAPI")
Set TargetFolderItems = ns.Folders.Item("Personal Folders").Folders.Item("Daily Transaction Files").Items

JP2112
10-04-2011, 10:46 AM
Change

ns.Folders.Item("Personal Folders").Folders.Item("Daily Transaction Files").Items

to

ns.GetDefaultFolder(olFolderInbox).Folders("Reports").Folders("Daily Transaction Files").Items

stevenab
10-04-2011, 10:53 AM
Thank you very much. I am no longer getting the error msg. I'll have to wait over night to see if the macro grabs the new files coming into that folder.

Thanks again