it is better to post the code you use to build the file name you are going to open, the problem is there

there are many debugging techniqus you can use to figure out where the wrong code

from Debug menu add break points on the lines you are doubt on it, and when the execution break check your variables if it contains the expected data or not

also you can use Add Watch... from Debug menu to add a variable that you want to watch and select Break When Value Change option, if you use a public variable its value maybe changed in unexpected places

also there is debug step into (F8) it is very useful too

Good Luck