G
Guest
I am using the dropdown event of a ComboBox to make the Calendar visible then
doing a SetFocus and I receive a Run-time error stating:
Automation error
The object invoked has disconnected from its clients.
I am fairly new to VBA and not really sure what is causing this and how to
work around it. I have tried just adding "on error resume next" but that
doesnt prevent the error. Can you give me an Idea what I am doing wrong?
The following is my code:
In a seperate Module
Sub ShowFormCalendar()
TrunkCalendarForm.Show
End Sub
In the Userform code itself:
Private Sub MondayComboBox_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
TrunkCalendar.Visible = True
TrunkCalendar.SetFocus 'After this is when i get the error
End Sub
Private Sub TrunkCalendar_Click()
MondayComboBox.Value = TrunkCalendar.Value
End Sub
Private Sub UserForm_Initialize()
TrunkCalendar.Value = Date
End Sub
doing a SetFocus and I receive a Run-time error stating:
Automation error
The object invoked has disconnected from its clients.
I am fairly new to VBA and not really sure what is causing this and how to
work around it. I have tried just adding "on error resume next" but that
doesnt prevent the error. Can you give me an Idea what I am doing wrong?
The following is my code:
In a seperate Module
Sub ShowFormCalendar()
TrunkCalendarForm.Show
End Sub
In the Userform code itself:
Private Sub MondayComboBox_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
TrunkCalendar.Visible = True
TrunkCalendar.SetFocus 'After this is when i get the error
End Sub
Private Sub TrunkCalendar_Click()
MondayComboBox.Value = TrunkCalendar.Value
End Sub
Private Sub UserForm_Initialize()
TrunkCalendar.Value = Date
End Sub