warren2600
Programmer
Can someone take a look at my code.
i'm working on several different projects and my brain hurts.
Private Sub Command1_Click()
Dim fso As New FileSystemObject
Dim f As Folder, sf As Folder, path As String
Dim server As String
Dim i As Integer
Dim FileArray() As String
server = combServers.Text
'get rid of spaces for UNC path
server = RTrim(Left(server, InStrRev(server, " "))) & _
LTrim(RTrim(Right(server, Len(server) - InStrRev(server, " "))))
'Initialize path.
path = ("folder path")
'Get a reference to the Folder object.
Set f = fso.GetFolder(path)
For Each sf In f.SubFolders
'this is where the error occurs "subscript out of range"
------------> FileArray(i) = path <------------
i = i + 1
Next
'send array to function to calculate size
portalSize1 (FileArray)
End Sub
any input would help
thanks in advance,
warren
i'm working on several different projects and my brain hurts.
Private Sub Command1_Click()
Dim fso As New FileSystemObject
Dim f As Folder, sf As Folder, path As String
Dim server As String
Dim i As Integer
Dim FileArray() As String
server = combServers.Text
'get rid of spaces for UNC path
server = RTrim(Left(server, InStrRev(server, " "))) & _
LTrim(RTrim(Right(server, Len(server) - InStrRev(server, " "))))
'Initialize path.
path = ("folder path")
'Get a reference to the Folder object.
Set f = fso.GetFolder(path)
For Each sf In f.SubFolders
'this is where the error occurs "subscript out of range"
------------> FileArray(i) = path <------------
i = i + 1
Next
'send array to function to calculate size
portalSize1 (FileArray)
End Sub
any input would help
thanks in advance,
warren