Thanks for taking the time to read my question
Name ReNamestrFileName As Right(ReNamestrFileName, 4) & "1.jpg"
The line above seems to delete my files. I don't know why, and wish it
wouldn't.
Any ideas on what I am doing wrong? If this would work, my function would
be perfect
My function is supposed to change files names *.JPG to *.jpg
Thanks,
Brad
Function below
---------------------------------
Function ImageNameDoc()
Dim strFileName, ReNamestrFileName As String
On Error GoTo ImageNameDoc_Err:
strFileName = Dir("C:\LNUPictures\Images\*.jpg")
ReNamestrFileName = "C:\LNUPictures\Images\" & strFileName
Open "C:\LNUPictures\ImageNames.txt" For Output As #1
Do While strFileName <> ""
'Rename to .jpg from .JPG
If Right(strFileName, 4) = ".JPG" Then
Name ReNamestrFileName As Right(ReNamestrFileName, 4) & "1.jpg"
FileCopy Right(ReNamestrFileName, 4) & ".jpg",
Right(ReNamestrFileName, 4) & ".jpg"
Kill Right(ReNamestrFileName, 4) & "1.jpg"
End If
If Right(strFileName, 8) = "zoom.jpg" Then
Print #1, strFileName
End If
If UserForm1.ProgressBar1.Value + Yb < 100 Then
UserForm1.ProgressBar1 = UserForm1.ProgressBar1 + Yb
Else
UserForm1.ProgressBar1 = 100
End If
strFileName = Dir
ReNamestrFileName = "C:\LNUPictures\Images\" & strFileName
Loop
Close #1
ImageNameDoc_Exit:
Exit Function
ImageNameDoc_Err:
MsgBox Err.Number & ", " & Err.Description
Close #1
End Function
Bookmarks