Open file in same directory as open macro-enabled file (on USB drive)
Hi guys,
I'm using the following code to bring text from a file into a cell in a word table.
This works great when the files are on a desktop and I can specify the path but I now need to use this file on the move and so the pah will always change.
The file being opened is always in the same directory as the macro-enabled file so what would I need to change to get this to work?
Code:
Code:
f = FreeFile
Open "C:\localdata\Passdown\log1361.txt" For Input As f
strvar = Input(LOF(f), #f) ' read file into variable
Close f
Thanks
Re: Open file in same directory as open macro-enabled file (on USB drive)
Code:
Open activedocument.path & "\log1361.txt" For Input As f
or thisdocument.path
Re: Open file in same directory as open macro-enabled file (on USB drive)
Thanks once again westconn1...in my defence I had tried ThisDocument.path "\logxxx.txt" and when that didn't work i was stumped!
Thanks again!