|Thank you, nbrane, you were so right and yes there was another next. The sad thing is that I had tried file.name and it threw up an error or so I thought! |
Unfortunately, when I had been trying to find the answer I had forgotten to remove a little piece of code I added in earlier in the script and it was this that produced the error message. I take your point re the confusion and as a newbie ought to start right as I mean to go on. Otherwise, I may run the risk of developing so called spaghetti style programming - remember the overuse of the GOTO back in the days of good old Basic!
I know this is maybe going a bit off script but when I was poring over my script to clean it up I discovered an anomaly I hadn't anticipated. The formatting was just as I wanted until one search I did messed it up. I was stumped for a good while until I sussed it was because the array, being period delimited, was reading a carriage return and line feed into the element along with the text whenever the previous line ended with a full stop - just as it should only I hadn't appreciated that! I solved the problem by using Replace(strContents, vbCrLf, "") to strip out all the carriage returns and line feeds.
I mention this just for the benefit of any other newbie out there who might have problems because they are unaware that an array element can include a CRLF
Thank you once again for your help and support!