Copyfolder with the output searching for only part names.

lovett10

Registered User.
Local time
Today, 13:06
Joined
Dec 1, 2011
Messages
150
Here is my code
Code:
Function CreateWonJobFolders()
Dim fs, cf, QJobNum, pd
On Error Resume Next
  If [Forms]![QTender Edit]![Won] = -1 Then
    Msg = MsgBox("Create Project Folders?", vbYesNo, "Folder Creation")
    If Msg = 6 Then '(yes)
      QJobNum = [Forms]![QTender Edit]![QuoteNo]
      JobNum = Right(QJobNum, 5)
      Set fs = CreateObject("Scripting.FileSystemObject")
      Set cf = fs.CopyFolder("P:\PROJECT TEMPLATE - COPY ONLY\*.*", "P:\P" & JobNum & "\")
    End If
    
  End If
End Function

What i would like is for the output of the copy paste process to look at part of the file name not look for the whole name. For example at the moment it will look for "P12345" but if the file is called "P12345 test" it wont paste to that folder.

If you are worried about it finding more than one it wont as each "P" number is unique.

Thanks in advanced and i apologise in advanced if i havent made any sense :)
 
Unfortunately the File System Object doesn't have the functionality for searching part of a file name. It would have been the ultimate file/folder manager if it did. What you want to use is the Dir() function.
 

Users who are viewing this thread

Back
Top Bottom