Sub write_Batch_File()
Dim file As String
dateMath.dateMath 6
file = "M:\Research Team\Market Research\Monthly Validation\Source\CD121M_" & Year(dater) & mm & dd & ".PRF"
Set find = CreateObject("Scripting.FileSystemObject")
If Not find.FileExists(file) Then
MsgBox file & " was not located.", vbInformation, "File Not Found"
Else
programPath = """C:\Program Files\Mobius\DocuAnalyzer\Program\ANALYZER.EXE"""
sourcePath = """M:\Research Team\Market Research\Monthly Validation\Source\CD121M_" & mm & dd & yy & ".PRF"""
modelPath = """C:\Program Files\Mobius\DocuAnalyzer\Models\cd121m.xmod"""
outputPath = """M:\Research Team\Market Research\Monthly Validation\Source\CD121M_" & mm & dd & yy & ".xls"""
arr = Array(programPath, sourcePath, modelPath, outputPath)
On Error Resume Next: MkDir "C:\temp\": Filename = "C:\temp\Monarch.bat"
Set fso = CreateObject("scripting.filesystemobject")
Set ts = fso.CreateTextFile(Filename, True): ts.Write Join(arr, " "): ts.Close
CreateObject("WScript.Shell").Run Filename
End If
End Sub