zimy Posted July 14, 2007 Share Posted July 14, 2007 Just trying something out with Outlook. Goes through my Inbox gets all messages that contain attachments then its SUPPOSED to save them to a folder. However when i get to one method, SaveAsFile, it gives me this error: The requested action with this object has failed.: $attachment.SaveAsFile $filename $attachment.SaveAsFile ^ ERROR Dim $objOutlook, $objNameSpace, $objFolder, $MyItems Dim $objMessage, $attachment, $filename $objOutlook = ObjCreate("Outlook.application") $objNameSpace = $objOutlook.GetNameSpace("MAPI") $objFolder = $objNameSpace.GetDefaultFolder(6) $MyItems = $objFolder.Items For $objMessage In $MyItems For $attachment In $objMessage.Attachments $filename = "c:\" & $attachment.filename $attachment.SaveAsFile $filename Next Next Thanks for any help or pointers Link to comment Share on other sites More sharing options...
RDSchaefer Posted July 14, 2007 Share Posted July 14, 2007 Just trying something out with Outlook. Goes through my Inbox gets all messages that contain attachments then its SUPPOSED to save them to a folder. However when i get to one method, SaveAsFile, it gives me this error:The requested action with this object has failed.: $attachment.SaveAsFile $filename $attachment.SaveAsFile ^ ERRORThanks for any help or pointersPut Parentheses around the filename as inCODE$attachment.SaveAsFile($filename) Link to comment Share on other sites More sharing options...
zimy Posted July 14, 2007 Author Share Posted July 14, 2007 Put Parentheses around the filename as inCODE$attachment.SaveAsFile($filename)Tried that before and I couldnt get it to work... now it does... hahaThanks for the help Link to comment Share on other sites More sharing options...
laffo16 Posted December 13, 2007 Share Posted December 13, 2007 I'm trying to determin why when i run the ammended script above or any other outlook com script i find it bottles out. I get the Error: Varible must be of type "Object" the following line after '$objOutlook = ObjCreate("Outlook.Application")' i'm able to use ExcelCOM_UDF.au3 with its ObjCreate("Excel.Application")' and it functions fine. The system i am on is under certain user restrictions, i was unable to use the installer of autoit and had to use the zip pack. $objOutlook = ObjCreate("Outlook.Application") If Not IsObj($objOutlook) Then MsgBox(0, "", "no outlook object") EndIf ... returns "no outlook object". suggestions anyone? i've tried compile to exe and run with simular fail. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now