Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
shared file adds or deletes rows | Excel Discussion (Misc queries) | |||
Macro that deletes every third row....+ | Excel Discussion (Misc queries) | |||
Detecting when a user deletes a row | Excel Programming | |||
Repetative Row Deletes | Excel Discussion (Misc queries) | |||
Excel renaming file to a temp and deletes original (long) | Excel Programming |