Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#@When running excel macro file not found but it is there Hello,^_^ We are havin

ID: 3560555 • Letter: #

Question

#@When running excel macro file not found but it is there

Hello,^_^

We are having trouble running a macro created in 2003 and I think it is because we switched to 2010 version recently. @When we run vba code:    

Workbooks.Open Filename:="file.xls", Password:="password", WriteResPassword:="password"

it says file not found. But when I open it manually and then just go to the next line of code, it works. I am not sure if it is the file itself or the vba code, but we need to open the file as read only "no" in order to update it and then save it.   There are other issues with the macro like when it says "Downloading file..." or "Saving file..." it stays like that until we hit the cancel button and then the macro resumes. Any help will be greatly appreciated. Thank you.

Explanation / Answer

%T^ry ggiving the file path:

Workbooks.Open Filename:="C:Folder ile.xls", Password:="password", WriteResPassword:="password"

Or use a dialog to select the file:"

Workbooks.Open Filename:=Application.GetOpenFileName("Select the file"), Password:="password", WriteResPassword:="password"