ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   opening a file problem (https://www.excelbanter.com/excel-programming/378265-opening-file-problem.html)

diacci1st

opening a file problem
 
Hi I need to get the below to work but I can not understand why it does not
work
Could someone help?

Dim FName As Variant
FName = Application.GetOpenFilename("TXT files (*.txt),*.txt,All Files
(*.*),*.*", , , , True)
Open FName For Input As #1


Thank you


NickHK

opening a file problem
 

<Help file
..... If MultiSelect is True, the return value is an array of the selected
file names (even if only one filename is selected). Returns False if the
user cancels the dialog box.
</Help file

So you have to deal with an array of values not a single string. Also check
for False.

NickHK

"diacci1st" wrote in message
...
Hi I need to get the below to work but I can not understand why it does

not
work
Could someone help?

Dim FName As Variant
FName = Application.GetOpenFilename("TXT files (*.txt),*.txt,All Files
(*.*),*.*", , , , True)
Open FName For Input As #1


Thank you





All times are GMT +1. The time now is 09:50 PM.

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