
Option Explicit
Private muovi As Boolean
'dichiarazioni per celare tasto X chiusura
Private Declare Function SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long
Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long
Private Sub UserForm_Initialize()
'nascondo il tasto di chiusura dell'userform "X"
SetWindowLong FindWindow( _
vbNullString, Me.Caption), _
-16, -2067791744
End Sub
Private Sub UserForm_Activate()
'ad userform avviata variabile muovi vera attivo sub Animaz
muovi = True
Call Animaz
End Sub
Private Sub Animaz()
'variabili sequenza
Dim x As Integer, y As Integer, MyTimer As Double, SavePath
DoEvents
x = 1
y = 1
MyTimer = Timer
SavePath = ThisWorkbook.Path
'percorso cartella e immagini in essa contenute
SavePath = SavePath & "AnimazioneCles"
Do
On Error Resume Next
' carico nella proprietà immagine della userform l'immagine e l' estenzione
UserForm1.Image1.Picture = LoadPicture(SavePath & x & ".GIF")
' se non trova l'immagine evito l'errore
On Error GoTo 0
Do
'ciclo e durata frame
Loop While Timer - MyTimer < 0.15
If x = 12 Then
x = 1
Else
x = x + 1
End If
MyTimer = Timer
DoEvents
' ciclo animazione
Loop While muovi
muovi = False
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
' Inibizione della chiusura da tasto X nel caso non lo nascondiamo e messaggio di avvertimento
If CloseMode = 0 Then
Cancel = True
MsgBox "Non è possibile chiudere sino a completamento lavoro", vbCritical
End If
'muovi = False
End Sub
Private Sub Form_Load()
' Animazione scritta sorrevole del testo contenuto nella label e temporizzazione
Label1.Caption = "Attendere ...."
Timer1.Enabled = True
Timer1.Interval = 300
End Sub
Private Sub Timer1_Timer()
' sequenza caratteri della stringa scorrevole
Dim str As String
str = Form1.Label1.Caption
str = Mid(str, 2, Len(str)) & Left(str, 1)
Form1.Label1.Caption = str
End Sub |
application.cursor=xlWait
application.StatusBar="Attendere... " & i & "%"
Application.ScreenUpdating = False Application.EnableEvents = False 'New Application.Calculation = xlCalculationManual 'New 'Qui prosegue il codice.... Application.Calculation = xlCalculationAutomatic 'New Application.EnableEvents = True 'New Application.ScreenUpdating = True |
Private Sub CommandButton5_Click() 'CREA CALENDARIO GARE
tipo = 0
UserForm4.Show
If tipo = 0 Then
MsgBox "Devi scegliere il tipo di torneo", vbExclamation, "ATTENZIONE"
Exit Sub
End If
Dim creo As VbMsgBoxResult
Dim t As Date
t = Now
Call Scopri_tutti_fogli
' modifica Sid del 23-05-13
If Application.WorksheetFunction.CountA(Sheets("Ordine").Range("A2:A22")) < 3 Then
MsgBox "Devi selezionare una lista di almeno tre squadre", vbCritical: Exit Sub
End If
' fine modifica
Application.ScreenUpdating = False
Application.EnableEvents = False 'isy
Application.Calculation = xlCalculationManual 'isy
creo = MsgBox("Vuoi davvero creare un torneo ''" & Nopt & "''?", vbYesNo + vbQuestion _
, "CONFERMA CREAZIONE TORNEO")
If creo = vbNo Then Exit Sub
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Visualizzazione form di attesa
UserForm3.Show False
UserForm3.Caption = "Avanzamento ... 0%"
DoEvents
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Application.ScreenUpdating = False
' ************************************
' cancella vecchi dati
' ************************************
.... cut
.... cut
End With
End With
If tipo = 1 Then
With Sheets("Risultati")
.Columns("E:G").Hidden = True
.Range("C1").Value = "UNICO"
.Range("H1").Value = "DATA"
.Range("H1").HorizontalAlignment = xlCenter
End With
End If
Application.Calculation = xlCalculationAutomatic 'isy
Application.EnableEvents = True 'isy
Application.ScreenUpdating = True
'nascondo la userform3 attesa
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ chiusura form tempo di attesa
Unload UserForm3
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'mostra messaggio che indica tempo trascorso per sviluppo macro
MsgBox "Completato in: " & Format(Now - t, "HH:MM:SS"), vbInformation _
, "CREATO CALENDARIO"
End Sub |
Application.ScreenUpdating = False
Application.EnableEvents = False 'isy
Application.Calculation = xlCalculationManual 'isy
creo = MsgBox("Vuoi davvero creare un torneo ''" & Nopt & "''?", vbYesNo + vbQuestion _
, "CONFERMA CREAZIONE TORNEO")
If creo = vbNo Then Exit Sub
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Visualizzazione form di attesa
Dim Iniz As Integer
UserForm3.Show False
UserForm3.Caption = "Attendere prego ... "
With UserForm3
.Label1.Caption = "Caricamento calendari"
.ProgressBar1.Value = 0
.ProgressBar1.Max = 100
.Repaint
End With
For Iniz = 1 To 5
UserForm3.ProgressBar1.Value = (Iniz / 5) * 100
'Label1 = "Percentuale di avanzamento " & (Iniz / 5) * 100
Application.Wait Now + TimeValue("00:00:01")
DoEvents
Next
DoEvents
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'Application.ScreenUpdating = False
' ************************************
' cancella vecchi dati
' ************************************ |
