I have already opened a workbook but I am running a macro from another workbook. I would like to activate the first workbook using my name.
Code:
filename = input_path_ & amp; Input_file_1 workbooks (filename.xls). Activate
When I try to do this, it is giving me "out of bounds" error, how do I solve it?
Check if the file name is correct in your variable filename
. (Like Sample.xls )
Also check that if input_path_1
and input_file_1
have the correct values.
If they should have this:
workbooks (filename). Now Activate
Now, if you want to add an extension name (such as filename
value only sample ):
Activate workbooks (filename and ".xls")
The argument must always be in the string form and the full filename should be (with the extension) even though the digits ( Index) are also accepted, so you can not be sure which workbook you see. Better yet, specify it in a variable
Edit1: For the above other condition, if there is a full path in filename
, then it can work. The string filename 1 = split (filename, "\") (Ubound (split (filename, "\")) workbooks (filename 1) as a filtered filename
Activate
No comments:
Post a Comment