Subscript out of range: '1'
Jeg har et problem med et stykke kode, der skal vise indhold samt det første billede i undermapper på en given sti. Når jeg har mere end 3 undermapper, får jeg fejlenMicrosoft VBScript runtime error '800a0009'
Subscript out of range: '1'
koden fejlen ved *****:
<%
strPhysicalPath = PAGES_TO_UPLOAD
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPhysicalPath)
For each Folder in objFolder.SubFolders
If Left(Folder.Name,1)<>"_" Then
set fso = CreateObject("Scripting.fileSystemObject")
set fold = fso.getFolder(Folder)
fileCount = fold.files.count
dim fNames()
redim fNames(fileCount)
cFcount = 0
for each file in fold.files
cFcount = cFcount + 1
fNames(cFcount) = lcase(file.name)
next
for tName = 1 to fileCount
for nName = (tName + 1) to fileCount
if strComp(fNames(tName),fNames(nName),0)=1 then
buffer = fNames(nName)
fNames(nName) = fNames(tName)
fNames(tName) = buffer
end if
next
next
for i = 1 to 1 '<-- ****** DENNE MELDER FEJL ******
Forsiden = image & fNames(i)
content = content & fNames(i) & "<br>"
next
Forsiden = LINK_TO_UPLOAD & "/" & Folder.name & "/" & Forsiden
'Response.write ("<h2><img src='.." & Forsiden & "' ></h2>")
Set fso = Nothing
Response.Write("<h2><a class=menu href=""index.asp?SubDir=Avisen&Folder="&Folder.Name&"""><img src='.." & Forsiden & "' > Avisen, Uge "& Folder.Name & "</a></h2>")
End if
Next
Set objFSO = Nothing
%>