Link to home
Start Free TrialLog in
Avatar of jiiins2
jiiins2

asked on

Open hidden txt files with VBA Open statement

Hello,

in an Excel 2003 vba function I'm trying to open a normal txt file like this:
Open filename for input as #1

It works fine until I hide the file (using explorer's file properties). When the file is hidden, the function can't find it anymore... what am I missing? How can I retrieve it when is hidden?

Thanks,
J
Avatar of ahammar
ahammar
Flag of United States of America image

Is there anything special about your function that you haven't mentioned?  I just tried it and the code that you are using will open and read a text file just fine in a sub procedure, even if it is hidden with explorer's file properties...
Are you sure you didn't accidently change the name or location of the file in Explorer or your code?
Is there anything else that you can tell us...maybe paste your problem code here for us to see...

:-)
ah
Avatar of jiiins2
jiiins2

ASKER

Here is the code:

flFees = ThisWorkbook.Path & "\fees.txt"
Open flFees For Output As #1                    <- here I get run-time error 75

If I unhide fees.txt it works fine.
ASKER CERTIFIED SOLUTION
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jiiins2

ASKER

Thanks for the quick answer and sorry for my confused input/output question!