1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
Private Sub UserForm_Initialize()
Me.StartUpPosition = 3
'Fax Sent
Worksheets("Parms").Range("C20") = 0
Me.Fax_Sent = Worksheets("Parms").Range("C20")
'Fax Sent Cumulated
Me.Fax_Sent_Cumulated = Worksheets("Parms").Range("C21")
Search_file = Folder & Trim(Worksheets("Parms").Range("C3"))
DoEvents
Me.Repaint
End Sub
Private Sub Start_Polling_Click()
'4. Loop until button Stop used
Do While BStop = False
Found_Entry = ""
Found_Entry = Dir(Search_file, vbNormal)
Do While Found_Entry <> "" And BStop = False ' Start the loop.
Me.Status_text = "Sending " & Folder & Trim(Found_Entry)
Sent_Status = Send_1_File(Folder, Found_Entry, Attachement_folder, Me.Debug_Sw, P_Phwnd, O_Attachement_file)
If Not Sent_Status Then Exit Sub
Me.Last_File_Name = Folder & Trim(Found_Entry)
Worksheets("Parms").Range("C20") = Worksheets("Parms").Range("C20") + 1
Me.Fax_Sent = Worksheets("Parms").Range("C20")
Worksheets("Parms").Range("C21") = Worksheets("Parms").Range("C21") + 1
Me.Fax_Sent_Cumulated = Worksheets("Parms").Range("C21")
Me.Status_text = "Waiting 2 sec before next entry"
Application.Wait (Now + TimeValue("0:00:02"))
Found_Entry = Dir ' Get next entry.
Loop
If BStop = False Then
Me.Status_text = "Waiting 10 sec before Polling"
Application.Wait (Now + TimeValue("0:00:10"))
End If
DoEvents
Loop |
Partager