try
if instr(mainPath, "xx") > 0 then msgbox "mainPath containsxx"
This seems to throw the msgbox up even though xx is not in the file name.
I think I might have to re-thing the way I have written out the code altogether, I am not really comfortable with it, the way it's laid out doesn't seem to make much sence, it's all just willy nilly.
Back to the drowing board with this one
Thanks for the help.
John