RP1America
Technical User
I need to revise the code below to allow for a wildcard.
frmPCSS.txtSRQ.Text will always be 8 digits. However, the folder I am searching for may include characters after those 8 digits.
Example:
Folder may be -
"SRQ12345678" or "SRQ12345678 - Test"
How can I update my code for the strPath and the .SaveAs to incorporate this possible wildcard?
Basically, there may or may not exist a folder. If it exists, I need the file to be saved in that folder. If it does not, I need to create the folder and save the file within. But again, if the folder already exists, it may have extra characters past what is being input by the user.
Thoughts?
frmPCSS.txtSRQ.Text will always be 8 digits. However, the folder I am searching for may include characters after those 8 digits.
Example:
Folder may be -
"SRQ12345678" or "SRQ12345678 - Test"
How can I update my code for the strPath and the .SaveAs to incorporate this possible wildcard?
Code:
Dim strPath As String
strPath = "K:\WMS\RS\Ideas\SRQ" & frmPCSS.txtSRQ.Text
If Dir(strPath, vbDirectory) = "" Then
MkDir strPath
End If
ActiveWorkbook.SaveAs strPath & "\SRQ" & frmPCSS.txtSRQ.Text & " - Project Prep Checklist.xlsx", FileFormat:=51
Basically, there may or may not exist a folder. If it exists, I need the file to be saved in that folder. If it does not, I need to create the folder and save the file within. But again, if the folder already exists, it may have extra characters past what is being input by the user.
Thoughts?