• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Error 1004 on workbooks.open

Costas

Member
Hi Chandoo,

I don't know what's happening with excel lately. Code that was working last week doesn't work now. This is the 3rd instance it happens. I'm using the code below and although the file opens (so my path and filename must be correct) I get the 1004 error and I can't move to the next line.

Code:
MyTxt = Application.ActiveWorkbook.Path & "\" & "Timesheet_SYD.xlsm"
Workbooks.Open FileName:=MyTxt, ReadOnly:=False

I've tried many different variations to the above and it doesn't work. I just can't think of what's causing this error when it was working before.

Thanks
Costas
 

Hi !

In this mod, if you hear a beep, the file does not exist !​
Code:
               MyTxt$ = ActiveWorkbook.Path & "\Timesheet_SYD.xlsm"
        If Dir(MyTxt) = "" Then Beep: Exit Sub
Workbooks.Open MyTxt
Do you like it ? So thanks to click on bottom right Like !
 
Could is be that you can't open the file in Write mode? I.e., the file can be opened, but code is failing since it can't get write access.
 
Found what was wrong. I had on open code in the file I was trying to open and that was causing the problem.

Thanks for your replies guys
 
Back
Top