Hey guys,
I was asked to help solve an issue another developer was having and I personally don't know much about it so I am turning to you guys for a little help/guidance.
My co-worker has created an ASP page that is trying to pull the latest report from the network. And the ASP is failing when it tries to create the FSO to scan the files. A virtual directory has not been created yet so he is pointing directly to the network path.
The page is using the FSO and excel, and when i click on one of the Excel report links i get "fso is nothing"
Here is the code:
I was asked to help solve an issue another developer was having and I personally don't know much about it so I am turning to you guys for a little help/guidance.
My co-worker has created an ASP page that is trying to pull the latest report from the network. And the ASP is failing when it tries to create the FSO to scan the files. A virtual directory has not been created yet so he is pointing directly to the network path.
The page is using the FSO and excel, and when i click on one of the Excel report links i get "fso is nothing"
Here is the code:
Code:
Function GetLatestReport(path, rptName) Dim fso Dim rptFolder Dim rptDate Dim fiTemp Dim fi Dim report Dim x Dim msg On error Resume Next msg = "" Set fso = CreateObject("Scripting.FileSystemObject") Window.status = "Retrieving " & rptName rptDate = CDate("1/1/1900") Set rptFolder = fso.GetFolder(path) If rptFolder Is Nothing Then msg = msg & "Could not find path to " & rptName & chr(13) Else For Each fi in rptFolder.Files msgbox fi.Name If err.number <> 0 Then msg = msg & err.Description & chr(13) err.Clear Else If InStr(1, Ucase(fi.Name), UCase(rptName)) > 0 Then If fi.DateCreated > rptDate Then Set fiTemp = fi rptDate = fiTemp.DateCreated End If ElseIf fi.Name > rptName Then Exit For End If End If Next report = fiTemp.Path End If If msg <> "" Then Msgbox "The following errors occurred during the page load:" & chr(13) & chr(13) & msg End If Set fso = Nothing GetLatestReport = report End Function
Comment