0

Good Afternoon. I've running into a situation I hope someone here can help with. I'm running Office 2010 on Windows XP and have an Excel worksheet that contains a button to show a modal form (Form01). Form01 contains 3 Listboxes of data. Double-Clicking a item in listbox2 will open another modal form (Form02) so the item can be modified. Unloading Form02 will save the data and call a couple of macros to adjust a named range on the host worksheet. This code is stored in a Module, not on the form.

This is where the problem occurs. When Form02 is unloaded and Form01 is accessable, I cannot select anything in listbox1 or listbox3 or buttons on Form01. I have to first select something in listbox2, then I have access to the other controls on the form. I've tried to .SetFocus on the other controls and add DoEvents after the Form02.Show 1 statement with no luck. The only workaround I've found is to hide and reshow Form01 which causes the screen to flicker. Application.ScreenUpdating = False and back to True doesn't seem to help either. I really need to figure out what the other controls are not accessible when Form02 is shown and then closed. Has anyone else experienced this behaviour or might have a suggestion?

4

1 回答 1

0

改变这个

Private Sub lstSiteMaster_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    If lstSiteMaster.ListCount = 0 Then Exit Sub
    LoadFrmEditDataset Me.Controls("lstSiteMaster"), "SITE MASTER"
    frmEditDataset.Show 1
    Unload frmEditDataset
    DoEvents
    Me.lstSiteMaster.ListIndex = -1
    Me.lstSiteList.ListIndex = -1
    Me.lstMiniPOR.ListIndex = -1
    '''BounceTheForm
End Sub

Private Sub lstSiteMaster_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    If lstSiteMaster.ListCount = 0 Then Exit Sub
    LoadFrmEditDataset Me.Controls("lstSiteMaster"), "SITE MASTER"
    frmEditDataset.Show 1
    DoEvents
    Me.lstSiteMaster.ListIndex = -1
    Me.lstSiteList.ListIndex = -1
    Me.lstMiniPOR.ListIndex = -1
    '''BounceTheForm
End Sub

这个

Private Sub cmdApply_Click()
    With Me
        UpdateDataset .lblDataset, .lblECR, .lblFA, .lblFieldId, .txtFieldValue, .cboAction, .lblIndex + 2
    End With

    Me.Hide
End Sub

Private Sub cmdApply_Click()
    With Me
        UpdateDataset .lblDataset, .lblECR, .lblFA, .lblFieldId, .txtFieldValue, .cboAction, .lblIndex + 2
    End With

    Unload Me
End Sub
于 2013-03-23T05:16:46.123 回答