a.kawkab
عدد المساهمات : 20 تاريخ التسجيل : 31/05/2017
| موضوع: كود فورم قصص الانبياء السبت نوفمبر 30, 2019 10:30 pm | |
| بارك الله فيك استاذ مجدى وفي اعمالك وربنا يعطيك طيلة العمر والعافية لى رجاء عند حضرتكم ممكن كود فورم قصص الانبياءلانئ شغال على فورم بروتوكلات الادوية بنفس فكرة حضرتك لذلك محتاج اكواد الvbaالتى استحدمتها فى فورم قصص الانباء ضرورى جعلك الله ذخراللعلم[/b] | |
|
مجدى يونس Admin
عدد المساهمات : 3773 تاريخ التسجيل : 22/02/2013 العمر : 69
| موضوع: رد: كود فورم قصص الانبياء الأحد ديسمبر 01, 2019 7:01 am | |
| اليك الكود - الكود:
-
Option Explicit Dim TopicCount, CurrentTopic As Integer, Data As Worksheet
'Customize The Following Statement To Correspond To The Worksheet That Contains The Help Topics Const DataName As String = "Data"
'Customze The Following Statement To Change The Caption Displayed On The Form Const HelpFormCaption As String = "Data"
Private Sub CommandButton4_Click() Dim X, d, yuk As Integer
If CommandButton4.Caption = "8" And Data_Form.Width = 410 Then For d = 1 To 158 DoEvents yuk = 310 Data_Form.Width = yuk - d Next ComboBoxTopics.Enabled = True ComboBoxTopics.ListIndex = 0 CommandButton4.Caption = "9" Exit Sub End If
If CommandButton4.Caption = "9" And Data_Form.Width = 352 Then For X = 1 To 458 DoEvents yuk = 252 Data_Form.Width = yuk + X Next ComboBoxTopics.Enabled = False CommandButton4.Caption = "8" End If
End Sub
Private Sub LabelTopic_Click()
End Sub
Private Sub ListBox1_Click() CurrentTopic = ListBox1.ListIndex + 1 ListBox1.ListIndex = CurrentTopic - 1 ComboBoxTopics.ListIndex = ListBox1.ListIndex Me.Caption = HelpFormCaption & " (" & CurrentTopic & " of " & TopicCount & ")" With LabelTopic .Caption = Data.Cells(CurrentTopic, 2) .AutoSize = False .Width = 350 .AutoSize = True End With End Sub
Private Sub SpinButton1_SpinDown() On Error Resume Next If ListBox1.ListIndex = ListBox1.ListCount - 1 Then Exit Sub With Me.ListBox1 .ListIndex = .ListIndex + 1 End With End Sub
Private Sub SpinButton1_SpinUp() On Error Resume Next If ListBox1.ListIndex = 0 Then Exit Sub With Me.ListBox1 .ListIndex = .ListIndex - 1 End With End Sub
Private Sub UserForm_Initialize() ' Executed before the form is shown Dim Row As Integer Me.Width = 352 Set Data = ThisWorkbook.Sheets(DataName) TopicCount = Application.WorksheetFunction.CountA(Data.Range("A:A")) For Row = 1 To TopicCount ComboBoxTopics.AddItem Data.Cells(Row, 1) ListBox1.AddItem Data.Cells(Row, 1) Next Row ComboBoxTopics.ListIndex = 0 CurrentTopic = 1 UpdateForm End Sub
Private Sub UpdateForm() ' Updates the topics ComboBoxTopics.ListIndex = CurrentTopic - 1 Me.Caption = HelpFormCaption & " (" & CurrentTopic & " of " & TopicCount & ")" With LabelTopic .Caption = Data.Cells(CurrentTopic, 2) .AutoSize = False .Width = 312 .AutoSize = True End With Frame1.ScrollTop = 1 Frame1.ScrollHeight = LabelTopic.Height + 5 If CurrentTopic = 1 Then PreviousButton.Enabled = False Else PreviousButton.Enabled = True If CurrentTopic = TopicCount Then NextButton.Enabled = False Else NextButton.Enabled = True On Error Resume Next If NextButton.Enabled Then NextButton.SetFocus Else PreviousButton.SetFocus End Sub
Private Sub ComboBoxTopics_Click() ' Executed when combobox is changed CurrentTopic = ComboBoxTopics.ListIndex + 1 UpdateForm ListBox1.ListIndex = CurrentTopic - 1 End Sub
Private Sub PreviousButton_Click() ' Executed when the PreviousButton is clicked If CurrentTopic <> 1 Then CurrentTopic = CurrentTopic - 1 UpdateForm End If End Sub
Private Sub NextButton_Click() ' Executed when the NextButton is clicked If CurrentTopic <> TopicCount Then CurrentTopic = CurrentTopic + 1 UpdateForm End If End Sub
Private Sub ExitButton_Click() ' Executed when the ExitButton is clicked Unload Me End Sub
Private Function SheetExists(sht) As Boolean Dim TempSheet As Worksheet On Error Resume Next Set TempSheet = ThisWorkbook.Worksheets(sht) If Err = 0 Then SheetExists = True Else SheetExists = False End Function
| |
|
a.kawkab
عدد المساهمات : 20 تاريخ التسجيل : 31/05/2017
| موضوع: رد: كود فورم قصص الانبياء الأحد ديسمبر 01, 2019 8:00 pm | |
| شكرا استاذ مجدى على الاستجابة السريعة حفظك الله ونفعنا بعلمك | |
|
مجدى يونس Admin
عدد المساهمات : 3773 تاريخ التسجيل : 22/02/2013 العمر : 69
| موضوع: رد: كود فورم قصص الانبياء الإثنين ديسمبر 02, 2019 12:16 am | |
| | |
|