I can already do this, but I suspect my method, whilst good in the general case, is not efficient for this simple scenario - I have code already that opens a txt file, reads in N lines of data to an array etc etc etc.
But today I have a need to import a single value from a txt file and use it in excel.
The text file contains just that single value. It can be assumed to always be a long - no need to do any error checking or type conversion for this question - it can never be anything else.
Assume the filename is:
and it contains just a number (as a text string in the text file I suppose):
So, who can get it into VBA in the simplest code, and assign it to a simple Long variable called lOutput (say).
Points go to simplest, but shorter is good too (since the two aren't always the same!)