PDA

View Full Version : [SOLVED] Problem after upgrade from Excel 97 to Excel 2000



Oropi
02-13-2005, 08:54 PM
This code would work in Excel 97 (from the help file):


Dim EntryCount As Single

Private Sub CommandButton1_Click()
EntryCount = EntryCount + 1
ListBox1.AddItem (EntryCount & " - Selection")
End Sub
Private Sub CommandButton2_Click()
'Ensure ListBox contains list items
If ListBox1.ListCount >= 1 Then
'If no selection, choose last list item.
If ListBox1.ListIndex = -1 Then
ListBox1.ListIndex = _
ListBox1.ListCount - 1
End If
ListBox1.RemoveItem (ListBox1.ListIndex)
End If
End Sub
Private Sub UserForm_Initialize()
EntryCount = 0
CommandButton1.Caption = "Add Item"
CommandButton2.Caption = "Remove Item"
End Sub


but, now that I have upgraded to Execl 2000 I get this error at "ListBox1.AddItem":

Error 80010108 Automation error. The object invoked has disconnected from its clients

Now I cannot use listboxes. Is there a workaround for this?

Jacob Hilderbrand
02-13-2005, 09:02 PM
Does this file work for you?

Oropi
02-13-2005, 09:08 PM
No I get the same error. I won't be able to reply for 16 hours (hometime).

Jacob Hilderbrand
02-13-2005, 09:12 PM
Ok, you probably have an error in the install. First uninstall Office completely. Then look in your Program Files folder and delete the MS Office folder.

Then re-install Office and see if the problem goes away.

Zack Barresse
02-13-2005, 09:18 PM
Hey,


Jake: Shouldn't you just be able to do a complete install and be able to overwrite all application (specific) files?

Jacob Hilderbrand
02-13-2005, 09:22 PM
You should, but everytime that I have had an error where I needed to re-install, trying to use the Detect and Repair or just installing on top of the old install has always failed to resolve anything.

When I delete everything and install fresh it has always worked for me.

Oropi
02-14-2005, 04:54 PM
I will have to ask our friendly IT people to do that!!!

In the meantime I have got this to work (I am wanting to select one or more filenames to send to a server by FTP):


Sub workaraound()
Set lb = Worksheets(1).Shapes.AddFormControl(xlListBox, 100, 10, 200, 100)
Worksheets(1).ListBoxes(1).Select
With Selection
.ListFillRange = ""
.LinkedCell = ""
.MultiSelect = xlSimple
.Display3DShading = False
End With
For i = 1 To intCount
mystamp = FileDateTime("d:\data\hockey\" & varFile(i))
chek = DateDiff("d", Now, mystamp)
If chek = 0 Then
lb.ControlFormat.AddItem varFile(i)
End If
Next i
Else
MsgBox "There were no files found."
End If
End sub

Sub peek()
Dim kname(10) As String
For i = 1 To Worksheets(1).ListBoxes(1).ListCount
If Worksheets(1).ListBoxes(1).Selected(i) = True Then
counter = counter + 1
kname(counter) = Worksheets(1).ListBoxes(1).List(i)
End If
Next I
?????
End sub

Oropi
02-15-2005, 01:18 PM
Problem solved with reinstalling Office

Jacob Hilderbrand
02-15-2005, 04:34 PM
Glad to help. :beerchug:

Take Care