Application Workbooks Open Error 1004
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us
Runtime Error 1004 Method Open Of Object Workbooks Failed
Learn more about Stack Overflow the company Business Learn more about hiring developers or run time error 1004 method open of object workbooks failed posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow
Excel Application Workbooks Open
Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Run-time Error '1004' - Method 'Open' of object 'Workbooks' vba application workbooks open failed up vote -1 down vote favorite OK, so far I've uninstalled & re installed Office-2010 3 to 4 times, done hours of research for 3 days with no success. I started getting this error either from Vbscript or Excel VBA, performing the same command that has worked for months. I am not sure what I may have changed, I don't recall changing anything that could cause application workbooks open filename it but I nailed it down to the ReadOnly:=True parameter. I think something may be wrong with the registry... but re-installing should fix it right? It didn't... Anyways, very simple command that I recorded on Excel 2010. This command WORKS FINE and the file opens: Sub Macro1() Workbooks.Open Filename:="C:\temp\file_9928_131101.xlsx" End Sub But when I add the ReadOnly:=True parameter, it does NOT WORK: Sub Macro1() Workbooks.Open Filename:="C:\temp\file_9928_131101.xlsx", ReadOnly:=True End Sub This is the returned error Run-time error '1004' Method 'Open' of object 'Workbooks' failed: When I click Debug, the error is at the only line of code. excel excel-vba share|improve this question edited May 11 at 17:05 TylerH 10.9k63666 asked Nov 13 '13 at 22:06 Fritz Larco 1114 HUH! Typo, sorry. I meant to put ReadOnly:=True. The error comes when I put ReadOnly:=True, not ReadOnly:=only. ReadOnly:=only is a typo that I made while typing the Question on stackoverflow. –Fritz Larco Nov 13 '13 at 22:18 Thanks, Nope, same error. –Fritz Larco Nov 13 '13 at 22:23 1 Nothing wrong with your code. Ensure that the file exists... Also are you doing this from Excel VBA or VBScript? –Siddharth Rout Nov 13 '13 at 22:23 F
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow
Corruptload:=xlrepairfile
the company Business Learn more about hiring developers or posting ads with us Stack run time error 1004 file could not be found Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community
Run Time Error 1004 Cannot Access File
of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Using Workbooks.Open on a known file location yields “Run-time error 1004
FileName could not be found error 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 http://www.vbforums.com/showthread.php?541906-RESOLVED-Excel-Runtime-error-1004-FileName-could-not-be-found-error the forum that you want to visit from the selection below. Results 1 to 12 of http://www.mrexcel.com/forum/excel-questions/694292-avoiding-error-1004-method-open-object-workbooks-failed.html 12 Thread: [RESOLVED] Excel Runtime error 1004 FileName could not be found error Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Oct 3rd, 2008,03:31 AM #1 GrayS View Profile View Forum Posts Thread Starter New Member Join Date Oct 2008 Posts 3 [RESOLVED] Excel Runtime error 1004 FileName could not error 1004 be found error I am a noob to these boards (and fairly new to Excel VBA), so please forgive if this is a dumb question. I have an Excel 2003 spreadsheet ("DgetWork.xls") with some VBA to automatically open a second spreadsheet ("DgetData.xls") when the first is opened. It used to work perfectly. Then work gave me a new laptop (still Excel 2003 though). Now it always fails with error: Run-time error '1004' 'DgetData.xls' could not be found. Check the spelling.... application workbooks open Please can somebody help me to get this working again? I have installed all the add-on packs to no avail. The spelling of the file name is correct, and the two spreadsheets are in the same folder. The Excel 2003 VBA in the first spreadsheet is as follows: Code: Function FileIsOpen(pFileName As String) As Boolean 'Function to test if a spreadsheet is open or not. On Error Resume Next FileIsOpen = Len(Excel.Application.Workbooks(pFileName).Name) End Function Private Sub Workbook_Open() ' Open data worksheet. If Not FileIsOpen("DgetData.xls") Then Workbooks.Open "DgetData.xls" End If ' Switch focus back to orignal worksheet. Workbooks("DgetWork.xls").Activate ' Now force update of links manually. ActiveWorkbook.UpdateRemoteReferences = True End Sub It fails on the line: Code: Workbooks.Open "DgetData.xls" This used to work. Now it doesn't. Please help. Cheers, Gray Attached Images Reply With Quote Oct 3rd, 2008,07:19 AM #2 westconn1 View Profile View Forum Posts PowerPoster Join Date Dec 2004 Posts 21,897 Re: Excel Runtime error 1004 FileName could not be found error you need to supply the full path to the workbook to open, as well as the filename 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 R
Forums Excel Questions avoiding error 1004 method open of object workbooks failed Results 1 to 6 of 6 avoiding error 1004 method open of object workbooks failedThis is a discussion on avoiding error 1004 method open of object workbooks failed within the Excel Questions forums, part of the Question Forums category; I am trying to merge some excel 2003 work books in one excel 2010 workbook with VBA and experiencing following ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Mar 29th, 2013,01:52 PM #1 khawarameer Board Regular Join Date Jun 2009 Location Karachi, Pakistan Posts 136 avoiding error 1004 method open of object workbooks failed I am trying to merge some excel 2003 work books in one excel 2010 workbook with VBA and experiencing following error "Error 1004 method open of object workbooks failed" Following code is used. Sub GetSheets() Path = "C:\Users\bal-admin\Desktop\Transfer Register\" Dim number As Integer number = 1 Filename = Dir(Path & "*.xls") Do While Filename <> "" Workbooks.Open Filename:=Path & Filename, ReadOnly:=True For Each Sheet In ActiveWorkbook.Sheets ActiveSheet.Name = number Sheet.Copy After:=ThisWorkbook.Sheets(1) number = number + 1 Next Sheet Workbooks(Filename).Close savechanges:=False Filename = Dir() Loop End Sub Any solution please Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Mar 29th, 2013,02:11 PM #2 Andrew Poulsom MrExcel MVPModerator Join Date Jul 2002 Posts 73,092 Re: avoiding error 1004 method open of object workbooks failed Are you sure that the file you are trying to open is a valid Excel file? It must exist because Dir has returned its name. Can you open it manually? Share Share this post on Digg Del.icio.us Technorati Twitter Microsoft MVP - Excel Reply With Quote Mar 29th, 2013,02:20 PM #3 par60056 Board Regular Join Date Jul 2012 Location Chicago, IL Posts 1,560 Re: avoiding error 1004 method open of object workbooks failed is it possible that there is a macro run when the book is opened? Are you sure it is the open giving the error and not the close? Looking at your code I see a couple things that are going to cause problems. Share Sha