![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
D'oh!!!! 8\
Thank you, Sue. It now works great!! Ed On Apr 18, 12:59*pm, "Sue Mosher [MVP-Outlook]" wrote: The problem isn't with SaveAsFile but with your file name. A file name cannot include the / characters that you're adding with strDate. Windows interprets those as part of a file path which, of course, does not exist. -- Sue Mosher, Outlook MVP * *Author of Microsoft Outlook 2007 Programming: * * *Jumpstart for Power Users and Administrators * *http://www.outlookcode.com/article.aspx?id=54 "Ed from AZ" wrote in ... (WinXPpro, OL2003) I have a PST folder full of emails with Word documents as attachments. *I am trying to write a macro that will open each of these emails and save the attachments to a folder as Word docs. *I am fairly decent with Word and Excel VBA, but not very familiar with Outlook VBA. *I found the SaveAsFile method, but I don't quite understand how it works. *I'm trying to use it in the following code, but it errors out: x = objDestFolder.Items.Count For cntI = 1 To x *Set objItem = objDestFolder.Items(cntI) *y = objItem.Attachments.Count *For cntA = 1 To y * *Set objAtt = objItem.Attachments(cntA) * *strDoc = Left(objAtt.DisplayName, Len(objAtt.DisplayName) - 4) * *strDate = Format(objItem.CreationTime, "mm/dd/yy") * *strFile = strPath & strDoc & "_(" & strDate & ").doc" * *objAtt.SaveAsFile strFile * ERROR HERE *Next cntA Next cntI I can get to the folder, the email, and the attachment. *All strings are fine. *The objAtt.SaveAsFile line, though, errors with -209256445: Cannot save the attachment. Path does not exist. Make sure the path is correct. Any help setting this straight is appreciated. Ed- Hide quoted text - - Show quoted text - |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Runtime error when using SaveAsFile method to save Outlook attachm | confused2 | Outlook and VBA | 7 | September 1st 08 07:29 AM |
How to understand header information on OE 6 | DavidJ726 | Outlook Express | 4 | December 12th 07 11:36 PM |
Cannot understand | Igor Fracellio | Outlook Express | 2 | December 3rd 06 11:35 PM |
SaveAsFile, RTF and embedded images | Rohan Salt | Outlook and VBA | 0 | November 30th 06 06:08 AM |
SaveAsFile - save as subject line instead of DisplayName | iamjbunni | Outlook and VBA | 1 | April 30th 06 08:54 AM |