|
'Public Sub Main()
'------------------------------------------------------------
' Sets the Data Date for all schedules in a folder
' By Ray Messinger : 20-Aug-02
'------------------------------------------------------------
Dim objmilestones(50)
today = Date
pYear = Year(today)
pMonth = Month(today) - 1
'--- Calc the Last Day of the provious month ---
LastEOM = DateSerial(pYear, pMonth + 1, 0)
'---- Get the Datadate -----
DataDate = InputBox("Enter the Data Date", "Data Date Set", LastEOM)
If DataDate = "" Then WScript.Quit
DataDate = Month(DataDate) & "/" & Day(DataDate) & "/" & Year(DataDate)
'---
Dim fso, folder, f1, fc
Set fso = CreateObject("Scripting.FileSystemObject")
'--- Change this to the folder name you would like to use:
folderspec = "C:\test"
Set folder = fso.GetFolder(folderspec)
Set fc = folder.Files
fcnt = 0
For Each f1 In fc
FName = f1.Name
MParts = Split(FName, ".")
FF = MParts(0)
TT = MParts(1)
TT = UCase(TT)
If TT = "ML7" or TT="ML8" or TT="ML9" or TT="MLA" Then 'if milestone file
i = i + 1
FileName = f1.Name
FilePath = f1.Path
Set objmilestones(i) = GetObject(FilePath, "Milestones")
'Start using the new schedule object
With objmilestones(i)
.Activate
.SetDebugMode "Off"
dd = .GetCurrentDate
.SetCurrentDate DataDate
.Refresh
'-- Save the file -----
nFileHandleVariant = .Save
.Close
End With
End If
Next
Set fso = Nothing
'---
MsgBox "Done"
End Sub
|