D
Darren Hill
I'm getting a very puzzling error on a form -
"Run Time error 70: Permission Denied"
There are no routines that write to file or registry in the entire project.
It always occurs in the same macro (it's listed in full below), on a
specific line:
frmManager.LstSetCurrent.List() = aCombatants
lstsetcurrent is a listbox on a form.
aCombatants is an array of variable size.
If anyone is willing to look over the spreadsheet I'm more than happy to
send it out. This is driving me up the wall!
Darren
---------------------
Sub FillSetList()
Dim CurrentSet As String
Dim RowIndex As Long
Dim ColumnIndex As Long
CurrentSet = "Set " & frmManager.TabStrip1.SelectedItem.index
iCountAll = Sheets("DataCombat").Range("A65536").End(xlUp).Row - 2
jCountAll = Application.CountA(Sheets("DataCombat").Range("1:1")) - 1
' fill the array with character names
' count how many instances of CurrentSet occur
jCount = Application.WorksheetFunction.CountIf( _
Sheets("DataCombat").Range("B1:B" & iCountAll + 2), CurrentSet)
If jCount = 0 Then GoTo Skip
ReDim aCombatants(jCount - 1, 4)
RowIndex = 0: ColumnIndex = 0
For iCount = 0 To iCountAll
If Sheets("DataCombat").Range("B" & iCount + 2).Value = CurrentSet
Then
ColumnIndex = 0
For jCount = 0 To 6
aCombatants(RowIndex, ColumnIndex) =
Sheets("DataCombat").Cells(iCount + 2, jCount + 1).Value
If jCount = 0 Then jCount = 2
ColumnIndex = ColumnIndex + 1
Next jCount
RowIndex = RowIndex + 1
End If
Next iCount
frmManager.LstSetCurrent.ColumnCount = 5
frmManager.LstSetCurrent.ColumnWidths = "72;48;48;72;48"
'##### The error occurs on the next line
frmManager.LstSetCurrent.List() = aCombatants
Exit Sub
Skip:
frmManager.LstSetCurrent.Clear
End Sub
"Run Time error 70: Permission Denied"
There are no routines that write to file or registry in the entire project.
It always occurs in the same macro (it's listed in full below), on a
specific line:
frmManager.LstSetCurrent.List() = aCombatants
lstsetcurrent is a listbox on a form.
aCombatants is an array of variable size.
If anyone is willing to look over the spreadsheet I'm more than happy to
send it out. This is driving me up the wall!
Darren
---------------------
Sub FillSetList()
Dim CurrentSet As String
Dim RowIndex As Long
Dim ColumnIndex As Long
CurrentSet = "Set " & frmManager.TabStrip1.SelectedItem.index
iCountAll = Sheets("DataCombat").Range("A65536").End(xlUp).Row - 2
jCountAll = Application.CountA(Sheets("DataCombat").Range("1:1")) - 1
' fill the array with character names
' count how many instances of CurrentSet occur
jCount = Application.WorksheetFunction.CountIf( _
Sheets("DataCombat").Range("B1:B" & iCountAll + 2), CurrentSet)
If jCount = 0 Then GoTo Skip
ReDim aCombatants(jCount - 1, 4)
RowIndex = 0: ColumnIndex = 0
For iCount = 0 To iCountAll
If Sheets("DataCombat").Range("B" & iCount + 2).Value = CurrentSet
Then
ColumnIndex = 0
For jCount = 0 To 6
aCombatants(RowIndex, ColumnIndex) =
Sheets("DataCombat").Cells(iCount + 2, jCount + 1).Value
If jCount = 0 Then jCount = 2
ColumnIndex = ColumnIndex + 1
Next jCount
RowIndex = RowIndex + 1
End If
Next iCount
frmManager.LstSetCurrent.ColumnCount = 5
frmManager.LstSetCurrent.ColumnWidths = "72;48;48;72;48"
'##### The error occurs on the next line
frmManager.LstSetCurrent.List() = aCombatants
Exit Sub
Skip:
frmManager.LstSetCurrent.Clear
End Sub