My vba script in myMacro.xls Workbooks.Open Method works well, as shown below,
Workbooks.Open Filename:="D:\ExcelMacroProj\myTest.xls", ReadOnly:=True
But when I try to change the Filename value to a new path, as shown below, but all my actions did not work. Show Runtime Error 1004 .
Workbooks.Open Filename:="myTest.xls", ReadOnly:=True or Workbooks.Open Filename:="./myTest.xls", ReadOnly:=True or Workbooks.Open Filename:=".\myTest.xls", ReadOnly:=True
In fact, myMacro.xls and myTest.xls were placed in the same folder. Therefore, I want to go to the directory with flexible folders.
How can I fix this problem? Thank you for your reading and reply.
source share