Hi Guy's, I am saving file names (jpg) from the snip tool, renaming them with:
increment number, Post Code.jpg
The code here works 100%, however, These files are going into a folder per company name, the stumbling hurdle comes when a company name has got more than 1 depot, i need to try and find a method where it only renames files with certain names
Only if there is files already in that folder, hope i have explained correctly
If I add for example 3 more files to the folder that already has files, I am calling the files via the snip tool
1Capture, 2 Capture, 3Capture
Another way I can put this is:
If 1-Postcode, 2-Postcode, 3-POstcode files already exist, DO NOT rename these files, just the files called, the 3 newly added capture files are the only ones that want renaming.
Code:
Dim sPath As String, sDelTo As String, strPC As StringDim sOldFile As String, sNewFile As String
Dim i As Integer, iIndex As Integer
sDelTo = Me.txtName
strPC = Me.txtPC
If Left(Me.cboLocation, 1) = "H" Then
sPath = "C:\Users\davem\Desktop\Maps\" & sDelTo & "\"
End If
If Left(Me.cboLocation, 1) = "W" Then
sPath = "C:\Users\David\Desktop\Maps\" & sDelTo & "\"
End If
sOldFile = Dir(sPath & "*.jpg")
While sOldFile <> ""
i = i + 1
sNewFile = i & "-" & strPC & ".jpg"
Name sPath & sOldFile As sPath & sNewFile
sOldFile = Dir
Wend
I am thinking something like:
If Len(Dir(sPath & sNewFile)) >0
How do i not rename existing files, just ones called 1Capture etc......