vba - Bad file name or number when trying to read string from .txt -


i error when try open text file input. code looks right me...

enviro = cstr(environ("userprofile"))  filepath = "c:\users\" & enviro & "\appdata\roaming\microsoft\outlook\path.txt"  open filepath input #1  until eof(1)     line input #1, strpath  loop  close #1 

i intend text file have 1 line, path towards workbook.

using environ("userprofile") return e.g.:

c:\users\nalexp 

so need amend filepath assignment just:

filepath = enviro & "\appdata\roaming\microsoft\outlook\path.txt" 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -