"Expected end of statement" error in VBScript code.
I have written VBScript code to look for specific files in a folder and when the code finds the files the code will move the files to another folder. I am able to find one file and move it, but when I try to find two or more files I get the "Expected end of statement" error. I have included the code that I have written.
Dim objFSODim sSourceFolderDim sDestFolderDim sDBFileDim sDateTimeStamp'Const OVER_WRITE_FILES = FalseSet objFSO = CreateObject("Scripting.FileSystemObject")sSourceFolder = "C:\Oceanside\"sBackupFolder = "C:\Files_Found\"sDBFile = "ROWP19-0578 PERMIT","ROWP19-0579 PERMIT" 'Expected end of statement error on this line when I try to search for two filessDBFileExt = "pdf"'If the backup folder doesn't exist, create it.If Not objFSO.FolderExists(sBackupFolder) Then objFSO.CreateFolder(sBackupFolder)End If'Copy the file as long as the file can be foundIf objFSO.FileExists(sSourceFolder & "\" & sDBFile & "." & sDBFileExt) Then objFSO.CopyFile sSourceFolder & "\" & sDBFile & "." & sDBFileExt,_ sBackupFolder & "\" & sDBFile & "." & sDBFileExtMsgBox sSourceFolder & " was copied to " & sBackupFolderEnd ifSet objFSO = Nothing
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
sDBFile_arr = array("ROWP19-0578 PERMIT","ROWP19-0579 PERMIT" )
then loop each element in array
for each sdbfile in sdbfile_arr
'code
next