I can't figure out why I'm getting this error...
The system cannot find the file specified line 133.
Any help would be appreciated...below is my code
Dim objFS
Dim objFSFolder
Dim objFSFiles
Dim objFileObj
Dim objFileOut
Dim objFileIn
Dim objFileTemp
Dim objEmail
Dim intCounter
Dim strMessage
Dim tmpAddressAdd
Dim strFileProcessing
Dim strFileComplete
Dim strFileArchive
Dim strFileDistilled
Dim strFileDistilledLog
Dim objTouch
Dim lngReturn
Dim strDayOfYear
Dim intDayOfYear
Dim intYear
Dim intMonth
Dim intDay
Dim strReportName
Dim intReportNameSize
Dim strReportFacility
Dim objShell
Dim lngResult
Dim strShellCommand
Dim dtDateToCheckFrom
Dim intHour,intMinute,intSecond
Dim strLine
Dim strTemp
Dim intPos
Dim strFilePath
Dim dtFileDate
Dim x
Const intForReading = 1
Const strSearchLabel="CM Query Report:"
Const intPurgeFilesOlderDays=30
Const strCMFilePath_Source = "D:\Report2Web\HC_Reports\Inbound\"
Const strCMFilePath_Processing = "D:\Report2Web\HC_Reports\Processing\"
Const strCMFilePath_Archive = "D:\Report2Web\HC_Reports\Archive\Corporate\"
Const strCMFilePath_Complete = "D:\Report2Web\HC_Reports\Complete\"
Const strAdobeDistillerFilePath="D:\Program Files\Adobe\Acrobat 8.0\Acrobat\acrodist.exe"
Const strAdobeJobOptionsFilePath="D:\Program Files\Adobe\Acrobat 8.0\Acrobat\Settings\HC_Reports"
'*********************************************************************************
'CREATE COMMON OBJECTS
'*********************************************************************************
Set objShell = CreateObject("WScript.Shell")
Set objFS= WScript.CreateObject("Scripting.FileSystemObject")
'Set objTouch = CreateObject("TouchDate.Utilities")
'*********************************************************************************
'DETERMINE IF THERE ARE ANY FILES TO PROCESS
'*********************************************************************************
Set objFSFolder=objFS.GetFolder(strCMFilePath_Source)
Set objFSFiles=objFSFolder.Files
intCounter=0
For Each objFileObj In objFSFiles
'*********************************************************************************
'CALCULATE DAY OF YEAR VARIABLE TO ADD TO PROCESSED FILES
'*********************************************************************************
intYear = DatePart("yyyy",objFileObj.DateLastModified)
intDayOfYear = DatePart("y",objFileObj.DateLastModified)
strDayOfYear="_" & intYear & "_" & intDayOfYear
'*********************************************************************************
'DETERMINE REPORT NAME
'*********************************************************************************
strFileProcessing = strCMFilePath_Source & objFileObj.name
'Read input file
Set objFileIn=objFS.OpenTextFile(strFileProcessing,intForReading)
strReportName=""
Do Until objFileIn.AtEndOfStream
'Read in the next line
strLine = objFileIn.ReadLine
'If on the second line
intPos=InStr(strLine,strSearchLabel)
If intPos > 0 Then
strTemp=Mid(strLine,(intPos + Len(strSearchLabel)))
intPos = InStr(strTemp,")[")
If intPos > 0 Then
strReportName=UCase(Trim(Left(strTemp,intPos-1)))
End If
End If
Loop
Set objFileIn = Nothing
'*********************************************************************************
'FILTER OUT FACILITY NAME AND SET FACILITY VARIABLE
'*********************************************************************************
strReportFacility=""
Select Case Mid(strReportName,4,3)
Case "CH_" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Covenant\"
Case "MMC" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Methodist\"
Case "FSR" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Regional\"
Case "FSP" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Parkwest\"
Case "FSL" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Loudon\"
Case "FSS" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Sevier\"
End Select
'*********************************************************************************
'DISTILLS THE FILE
'*********************************************************************************
strFileDistilled = strCMFilePath_Processing & strReportName & strDayOfYear & ".PDF"
'Run the script
strShellCommand=strAdobeDistillerFilePath & strFileDistilled & " " & strFileProcessing
' D:\Program Files\Adobe\Acrobat 8.0\Acrobat\Settings\HC_Reports /Vff /Q /N /O " &
msgbox(strAdobeDistillerFilePath & " " & strFileDistilled & " " & strFileProcessing)
lngReturn = objShell.Run (strShellCommand, 1, 1)
'Delete the log file
strFileDistilledLog=strCMFilePath_Processing & strReportName & strDayOfYear & ".LOG"
If objFS.FileExists(strFileDistilledLog) Then
objFS.DeleteFile strFileDistilledLog
End If
'*********************************************************************************
'SET THE DATE MODIFIED TO MATCH THE SOURCE FILE DATE MODIFIED
'*********************************************************************************
strFilePath = strCMFilePath_Processing & strReportName & strDayOfYear & ".PDF"
intYear=Year(objFileObj.DateLastModified)
intMonth=Month(objFileObj.DateLastModified)
intDay=Day(objFileObj.DateLastModified)
dtFileDate = CDate(intMonth & "/" & intDay & "/" & intYear)
' x=objTouch.fnModifyDate(strFilePath, dtFileDate)
'*********************************************************************************
'COPY THE FILE THE ARCHIVE FOLDER
'*********************************************************************************
strFileArchive=strCMFilePath_Archive & strReportFacility & strReportName & strDayOfYear & ".PDF"
objFS.CopyFile strFileDistilled, strFileArchive
'*********************************************************************************
'COPY FILES TO THE COMPLETE FOLDER
'*********************************************************************************
strFileComplete=strCMFilePath_Complete & objFileObj.name
objFS.CopyFile strFileProcessing, strFileComplete
'*********************************************************************************
'DELETE DISTILLED FILE
'*********************************************************************************
objFS.DeleteFile strFileDistilled
'*********************************************************************************
'DELETE PROCESSED FILE
'*********************************************************************************
objFS.DeleteFile strFileProcessing
'*********************************************************************************
'Update file process counter
'*********************************************************************************
intCounter=intCounter+1
Next
'*********************************************************************************
'CLEAN UP COMPLETED FILES OLDER THEN 30 DAYS
'*********************************************************************************
'dtDateToCheckFrom=Now()
'intHour=Hour(dtDateToCheckFrom)
'intMinute=Minute(dtDateToCheckFrom)
'intSecond=Second(dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("h",-(intHour),dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("n",-(intMinute),dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("s",-(intSecond),dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("d",-(intPurgeFilesOlderDays),dtDateToCheckFrom)
'Set objFSFolder=objFS.GetFolder(strCMFilePath_Complete)
'Set objFSFiles=objFSFolder.Files
'For Each objFileObj In objFSFiles
' If objFileObj.DateLastModified < dtDateToCheckFrom Then
' 'Delete the File
' objFS.DeleteFile strCMFilePath_Complete & objFileObj.name
' End If
'Next
'**************************************************
'Email results
'**************************************************
'strMessage = "Reported: " & Now() & "" _
' & "<BR><BR>" _
' & "There were <B>" & intCounter & "</B> CareManager files loaded into Report2Web." _
' & "<BR><BR>" _
' & "Thanks," _
' & "<BR><BR>" _
' & "TaskScheduler on Report2web03"
'Set objMail = CreateObject("Persits.MailSender")
'objMail.Host = "smtp"
'objMail.From = "DoNotReply.com"
'objMail.Subject = "CareManager to Report2Web: Files processed summary"
'objMail.Body = strMessage
'tmpAddressAdd = objMail.AddAddress("email.com")
'tmpAddressAdd = objMail.AddAddress("email.com")
'tmpAddressAdd = objMail.AddAddress("email.com")
'objMail.IsHTML = True
'objMail.Send()
'Set objMail = Nothing
'*********************************************************************************
'CLEAN UP
'*********************************************************************************
Set objFileIn=Nothing
Set objFileOut=Nothing
Set objFileObj=Nothing
Set objFSFiles=Nothing
Set objFSFolder=Nothing
Set objFS=Nothing
Set objASPExec=Nothing
Set objShell = Nothing
Set objFileTemp=Nothing
Set objTouch = Nothing
The system cannot find the file specified line 133.
Any help would be appreciated...below is my code
Dim objFS
Dim objFSFolder
Dim objFSFiles
Dim objFileObj
Dim objFileOut
Dim objFileIn
Dim objFileTemp
Dim objEmail
Dim intCounter
Dim strMessage
Dim tmpAddressAdd
Dim strFileProcessing
Dim strFileComplete
Dim strFileArchive
Dim strFileDistilled
Dim strFileDistilledLog
Dim objTouch
Dim lngReturn
Dim strDayOfYear
Dim intDayOfYear
Dim intYear
Dim intMonth
Dim intDay
Dim strReportName
Dim intReportNameSize
Dim strReportFacility
Dim objShell
Dim lngResult
Dim strShellCommand
Dim dtDateToCheckFrom
Dim intHour,intMinute,intSecond
Dim strLine
Dim strTemp
Dim intPos
Dim strFilePath
Dim dtFileDate
Dim x
Const intForReading = 1
Const strSearchLabel="CM Query Report:"
Const intPurgeFilesOlderDays=30
Const strCMFilePath_Source = "D:\Report2Web\HC_Reports\Inbound\"
Const strCMFilePath_Processing = "D:\Report2Web\HC_Reports\Processing\"
Const strCMFilePath_Archive = "D:\Report2Web\HC_Reports\Archive\Corporate\"
Const strCMFilePath_Complete = "D:\Report2Web\HC_Reports\Complete\"
Const strAdobeDistillerFilePath="D:\Program Files\Adobe\Acrobat 8.0\Acrobat\acrodist.exe"
Const strAdobeJobOptionsFilePath="D:\Program Files\Adobe\Acrobat 8.0\Acrobat\Settings\HC_Reports"
'*********************************************************************************
'CREATE COMMON OBJECTS
'*********************************************************************************
Set objShell = CreateObject("WScript.Shell")
Set objFS= WScript.CreateObject("Scripting.FileSystemObject")
'Set objTouch = CreateObject("TouchDate.Utilities")
'*********************************************************************************
'DETERMINE IF THERE ARE ANY FILES TO PROCESS
'*********************************************************************************
Set objFSFolder=objFS.GetFolder(strCMFilePath_Source)
Set objFSFiles=objFSFolder.Files
intCounter=0
For Each objFileObj In objFSFiles
'*********************************************************************************
'CALCULATE DAY OF YEAR VARIABLE TO ADD TO PROCESSED FILES
'*********************************************************************************
intYear = DatePart("yyyy",objFileObj.DateLastModified)
intDayOfYear = DatePart("y",objFileObj.DateLastModified)
strDayOfYear="_" & intYear & "_" & intDayOfYear
'*********************************************************************************
'DETERMINE REPORT NAME
'*********************************************************************************
strFileProcessing = strCMFilePath_Source & objFileObj.name
'Read input file
Set objFileIn=objFS.OpenTextFile(strFileProcessing,intForReading)
strReportName=""
Do Until objFileIn.AtEndOfStream
'Read in the next line
strLine = objFileIn.ReadLine
'If on the second line
intPos=InStr(strLine,strSearchLabel)
If intPos > 0 Then
strTemp=Mid(strLine,(intPos + Len(strSearchLabel)))
intPos = InStr(strTemp,")[")
If intPos > 0 Then
strReportName=UCase(Trim(Left(strTemp,intPos-1)))
End If
End If
Loop
Set objFileIn = Nothing
'*********************************************************************************
'FILTER OUT FACILITY NAME AND SET FACILITY VARIABLE
'*********************************************************************************
strReportFacility=""
Select Case Mid(strReportName,4,3)
Case "CH_" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Covenant\"
Case "MMC" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Methodist\"
Case "FSR" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Regional\"
Case "FSP" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Parkwest\"
Case "FSL" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Loudon\"
Case "FSS" strReportFacility = "D:\Report2Web\HC_Reports\Complete\Sevier\"
End Select
'*********************************************************************************
'DISTILLS THE FILE
'*********************************************************************************
strFileDistilled = strCMFilePath_Processing & strReportName & strDayOfYear & ".PDF"
'Run the script
strShellCommand=strAdobeDistillerFilePath & strFileDistilled & " " & strFileProcessing
' D:\Program Files\Adobe\Acrobat 8.0\Acrobat\Settings\HC_Reports /Vff /Q /N /O " &
msgbox(strAdobeDistillerFilePath & " " & strFileDistilled & " " & strFileProcessing)
lngReturn = objShell.Run (strShellCommand, 1, 1)
'Delete the log file
strFileDistilledLog=strCMFilePath_Processing & strReportName & strDayOfYear & ".LOG"
If objFS.FileExists(strFileDistilledLog) Then
objFS.DeleteFile strFileDistilledLog
End If
'*********************************************************************************
'SET THE DATE MODIFIED TO MATCH THE SOURCE FILE DATE MODIFIED
'*********************************************************************************
strFilePath = strCMFilePath_Processing & strReportName & strDayOfYear & ".PDF"
intYear=Year(objFileObj.DateLastModified)
intMonth=Month(objFileObj.DateLastModified)
intDay=Day(objFileObj.DateLastModified)
dtFileDate = CDate(intMonth & "/" & intDay & "/" & intYear)
' x=objTouch.fnModifyDate(strFilePath, dtFileDate)
'*********************************************************************************
'COPY THE FILE THE ARCHIVE FOLDER
'*********************************************************************************
strFileArchive=strCMFilePath_Archive & strReportFacility & strReportName & strDayOfYear & ".PDF"
objFS.CopyFile strFileDistilled, strFileArchive
'*********************************************************************************
'COPY FILES TO THE COMPLETE FOLDER
'*********************************************************************************
strFileComplete=strCMFilePath_Complete & objFileObj.name
objFS.CopyFile strFileProcessing, strFileComplete
'*********************************************************************************
'DELETE DISTILLED FILE
'*********************************************************************************
objFS.DeleteFile strFileDistilled
'*********************************************************************************
'DELETE PROCESSED FILE
'*********************************************************************************
objFS.DeleteFile strFileProcessing
'*********************************************************************************
'Update file process counter
'*********************************************************************************
intCounter=intCounter+1
Next
'*********************************************************************************
'CLEAN UP COMPLETED FILES OLDER THEN 30 DAYS
'*********************************************************************************
'dtDateToCheckFrom=Now()
'intHour=Hour(dtDateToCheckFrom)
'intMinute=Minute(dtDateToCheckFrom)
'intSecond=Second(dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("h",-(intHour),dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("n",-(intMinute),dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("s",-(intSecond),dtDateToCheckFrom)
'dtDateToCheckFrom=DateAdd("d",-(intPurgeFilesOlderDays),dtDateToCheckFrom)
'Set objFSFolder=objFS.GetFolder(strCMFilePath_Complete)
'Set objFSFiles=objFSFolder.Files
'For Each objFileObj In objFSFiles
' If objFileObj.DateLastModified < dtDateToCheckFrom Then
' 'Delete the File
' objFS.DeleteFile strCMFilePath_Complete & objFileObj.name
' End If
'Next
'**************************************************
'Email results
'**************************************************
'strMessage = "Reported: " & Now() & "" _
' & "<BR><BR>" _
' & "There were <B>" & intCounter & "</B> CareManager files loaded into Report2Web." _
' & "<BR><BR>" _
' & "Thanks," _
' & "<BR><BR>" _
' & "TaskScheduler on Report2web03"
'Set objMail = CreateObject("Persits.MailSender")
'objMail.Host = "smtp"
'objMail.From = "DoNotReply.com"
'objMail.Subject = "CareManager to Report2Web: Files processed summary"
'objMail.Body = strMessage
'tmpAddressAdd = objMail.AddAddress("email.com")
'tmpAddressAdd = objMail.AddAddress("email.com")
'tmpAddressAdd = objMail.AddAddress("email.com")
'objMail.IsHTML = True
'objMail.Send()
'Set objMail = Nothing
'*********************************************************************************
'CLEAN UP
'*********************************************************************************
Set objFileIn=Nothing
Set objFileOut=Nothing
Set objFileObj=Nothing
Set objFSFiles=Nothing
Set objFSFolder=Nothing
Set objFS=Nothing
Set objASPExec=Nothing
Set objShell = Nothing
Set objFileTemp=Nothing
Set objTouch = Nothing