ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select a file (https://www.excelbanter.com/excel-programming/377917-select-file.html)

hmm

Select a file
 
I want to select a file and close it. But when execution reaches the line:

Windows("Scope1.txt").Activate

I get the error message:

Subscript out of range (Error 9).

The same command worked for an .xls file earlier in the program. Perhaps
the command is coded differently for a text file?

Appreciate anyone's help in how to do this. Thanks.


Tom Ogilvy

Select a file
 
If scope1.txt is the workbook name, then try using

Workbooks("Scope1.txt).Activate

--
Regards,
Tom Ogilvy


"hmm" wrote:

I want to select a file and close it. But when execution reaches the line:

Windows("Scope1.txt").Activate

I get the error message:

Subscript out of range (Error 9).

The same command worked for an .xls file earlier in the program. Perhaps
the command is coded differently for a text file?

Appreciate anyone's help in how to do this. Thanks.


hmm

Select a file
 
Thanks Tom; it worked! (See separate post for the next question arising.)

"Tom Ogilvy" wrote:

If scope1.txt is the workbook name, then try using

Workbooks("Scope1.txt).Activate

--
Regards,
Tom Ogilvy


"hmm" wrote:

I want to select a file and close it. But when execution reaches the line:

Windows("Scope1.txt").Activate

I get the error message:

Subscript out of range (Error 9).

The same command worked for an .xls file earlier in the program. Perhaps
the command is coded differently for a text file?

Appreciate anyone's help in how to do this. Thanks.



All times are GMT +1. The time now is 12:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com