Cdo Message 1 Error 80070020
van GoogleInloggenVerborgen veldenZoeken naar groepen of berichten
use 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. Results 1 to 5 of 5 Thread: cdo attach fails - file in use Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Aug 25th, 2009,04:50 AM #1 bbxrider View Profile View Forum Posts Thread Starter Lively Member Join Date Apr 2008 Posts 76 cdo attach fails https://groups.google.com/d/topic/microsoft.public.scripting.vbscript/RvJdqNjCxps - file in use my program creates an .xls and after saving it, i thought i closed down everything to do with the file, ExcelWorkbook.SaveAs workDir & Format(Now, "yyyyMMdd") & "topSites.xls" ExcelWorkbook.Close ExcelApp.Quit Set ExcelApp = Nothing Set ExcelWorkbook = Nothing Set ExcelSheet = Nothing at a later point trying to attach the file to an email with cdo objMessage.AddAttachment newTopSiteFile and i get -2147024864 80070020 process cannot access the file because it is http://www.vbforums.com/showthread.php?581703-cdo-attach-fails-file-in-use being used by another process. there is nothing else running on the machine that could possibly be using the file, somehow the program still has it tied up? even the 'unlocker' utility finds no locking handle? after the program ends if i restart it, and go directly to the attach, it works then something else with excel needs to be released? Reply With Quote Aug 25th, 2009,05:18 AM #2 westconn1 View Profile View Forum Posts PowerPoster Join Date Dec 2004 Posts 21,897 Re: cdo attach fails - file in use maybe you are not giving enough time for the excel file to be released, put a sleep in there, or loop on error till it succeeds i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part come back and mark your original post as resolved if your problem is fixed pete Reply With Quote Aug 25th, 2009,06:26 AM #3 si_the_geek View Profile View
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies http://stackoverflow.com/questions/3232014/excel-vba-error-when-adding-attachments-using-cdo-message-object-doesnt-suppor of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a cdo message minute: Sign up Excel VBA Error when adding attachments using CDO.Message “Object doesn't support this property or method” up vote 1 down vote favorite VBA/Excel Macro Programming - I'm trying to automate sending out an email with an Excel attachment. When I try and add an attachment, I get the following error: "Object doesn't support this property or method". Does anyone have cdo message 1 any ideas? It's not filename, filepath issues, the file exists, and the path is correct. Dim wbOld As Workbook Dim wbNew As Workbook Dim sheet As Variant Dim tempFilePath As String Dim tempFullFileName As String Dim sErr As String Dim vSheet As Variant 'Handle Excel screen changes and events With Application .ScreenUpdating = False .EnableEvents = False End With ' Set Outlook to send emails 'Set olApp = New Outlook.Application 'Set this workbook to active Set wbOld = ActiveWorkbook 'Copy sheets from the the old active workbook wbOld.Sheets(SheetsToEmail).Copy 'Create copy destination workbook Set wbNew = ActiveWorkbook 'Merge styles from the new workbook into the existing workbook. wbNew.Colors = Workbooks(wbOld.Name).Colors 'Save the new workbook, mail it and finally delete it tempFilePath = Environ$("temp") & "\" tempFullFileName = tempFilePath & NewWorkbookName & ".xlsm" 'In case the workbook already exists, kill it. 'Kill tempFullFileName 'Save With wbNew .SaveAs tempFullFileName, FileFormat:=xlOpenXMLWorkbookMacroEnabled .Close SaveChanges:=False End With sch = "http://schemas.microsoft.com/cdo/configuration/" Set cdoConfig = CreateObject("CDO.Configuration") cdoConfig.Fields.Item(sch & "sendusing") = 2 cdoConfig.Fields.Item(sch & "smtpserver") = "server.smtp.address" cdoConfig.Fields.Update Set cdoMessage = CreateObject("CDO.Message") Set cdoMessage.Configuration = cdoConfig cdoMessage.From = "test@email.com" cdoMessage.To = "receive_Test@email.c