Bir messageBox yanıtından sonra, kullanıcının ComboBox'a yönlendirilmesini istiyorum, 'aceCount'. Ancak, bu çizgiyi tamamen atlıyor gibi görünüyor. Aşağıdaki kodda, "Kod çalışıyor" ve "Odaktan sonra" iki mesaj kutusu var; Her ikisi de bu alanda kodu okuduğunu biliyorum, sadece setfocus parçasını tam olarak görmezden geliyor. Yapabileceğim her makaleyi okudum ve diğer sorular için birden fazla çözüm denedim, boşuna. Ayrıca, mesaj kutusundan sonra formdaki HERHANGİ bir yere odaklanmaz. Metin kutuları ve açılan kutular ile denedim.MsgBox'tan sonra, VBA, setfocus'u ComboBox'a yoksayar.
Düzenleme: İhtiyacım olan combobox'ta setfocus olarak ayarlanmış gibi görünüyor, ancak daha sonra aşağıdaki gibi kodlanmışsa ve kod ile çalıştırılıyorsa End olarak çalıştırılıyor. Kullanıcıya yeniden gönderme şansı vermez.
Private Sub SubmitButton_Click()
'Calls all necessary subs to perform required actions. If you add a sub, you will have to call it here if you want it to perform when you submit the form.
'If you have requested any number of HA Oracle servers, checks also if ACE and F5 are empty:
If Me.oracleCount.ListIndex > 0 Then
'If Ace and F5 are empty, MessageBox requesting review.
If aceCount.Value = 0 And F5Count.Value = 0 Then
If MsgBox("You have requested a HA Oracle server, but no Ace or F5. Do you need ACE or F5?", vbYesNo + vbQuestion, "ACE or F5?") = vbYes Then
'If chooses yes, goes back to form to allow user to input data
Cancel = True
MsgBox "code working"
UserForm1.aceCount.SelStart = 0
MsgBox "after focus"
'If chooses no, submits code as normal
Else
Call EnterData
Call HideSheets
Unload Me
**End If**
'If value in either Ace or F5, submits code as normal
ElseIf (Me.aceCount.Value <> 0 Or Me.F5Count.Value <> 0) Then
Call EnterData
Call HideSheets
Unload Me
End If
Else
End If
Call EnterData
Call HideSheets
Unload Me
End Sub
... –
evet, haklısın kullanabilirsiniz. Pek çok şeyi denerken, bu satırın yanlışlıkla silindiğini düşünüyorum. Bununla birlikte, kod aşağıdaki gibi olsa bile, odaklanma yok. 'Evet seçerse, veri girişi kullanıcı 'odak sonra'= 0 MsgBox UserForm1.aceCount.SetFocus UserForm1.aceCount.SelStart 'çalışma kodu'= Doğru MsgBox İptal izin oluşturmak üzere geri geçerse seçer hiçbir , kodu – aoman49