davidmyers
Board Regular
- Joined
- Jan 29, 2017
- Messages
- 88
- Office Version
- 2016
- Platform
- Windows
on openning a userform with the following code:
I get
Automation error
The object invoked has disconnected from its clients
Googling this I found:
https://support.microsoft.com/en-us...-behavior-with-office-automation-when-you-use
Which says this is caused because: "[FONT="]The code uses an unqualified method on an Office instance"
How do I qualify the method and resolve this issue?
Thanks for any help
David[/FONT]
Code:
Option Explicit
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
Dim txt As String
Dim i As Integer
txt = ""
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
If (txt > " ") Then
txt = txt & ", " & Me.ListBox1.List(i, 0)
Else
txt = Me.ListBox1.List(i, 0)
End If
End If
Next i
ActiveCell.Value = txt
Unload Me
End Sub
Private Sub UserForm_Initialize()
ListBox1.ListIndex = -1
Me.StartUpPosition = 0
Me.Top = 40
Me.Left = 615
End Sub
I get
Automation error
The object invoked has disconnected from its clients
Googling this I found:
https://support.microsoft.com/en-us...-behavior-with-office-automation-when-you-use
Which says this is caused because: "[FONT="]The code uses an unqualified method on an Office instance"
How do I qualify the method and resolve this issue?
Thanks for any help
David[/FONT]