Re: Name as to rename files
What are the values of changer and newnam?
It seems to me that changer will only contain the file name, and not the path (which is also needed).
By the way, why are you using GoTo's the way you are? A "Do Loop" would be more appropriate, eg:
VB Code:
..
'alpha:
Do
...
...
'GoTo alpha:
'Omega:
' If num < hour Then
' num = num + 1
' GoTo alpha:
' End If
num = num + 1
Loop While num <= hour
Re: Name as to rename files
To be honest I didn't know about Do Loop or how to use it, thanks for that tip.
When I debug the program 'changer' and 'newnam' both have the full path and filename. (In fact I copied and pasted the paths and filenames for my test program from the fields window when debugging the first program).
Re: Name as to rename files
In that case the only think that comes to mind is that Application.FileSearch may still have a lock on the file.
I haven't used it before, so I dont know if you need to close it somehow; it will probably be described in the help if you do.
One thing I can suggest is to add a line containing "DoEvents" to the line after "End With". This should hopefully give Application.FileSearch time to release the file.
Re: Name as to rename files
This looks like VBA code to me so I moved the thread to here.