
Sub Filtri()
MsgBox ("Stai attivando il filtro selezionato dal Cod. alla Commessa che segue:")
Application.Wait (Now + TimeValue("0:00:05"))
MsgBox ("Stai applicando il filtro selezionato dal Cod. alla " & _
Chr(13) & "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" & Chr(13) & " Commessa:" & Chr(13) & "[ " & (Range("G7").Value) & (" ]")), , ("Commessa")
Range("F9:F3000").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("D3:D4"), Unique:=False
Range("A10").Select
End Sub |
Sub Filtri()
Dim obj As Object
Dim strMsg As String
Set obj = CreateObject("WScript.Shell")
If Range("F8").Value = "non trovato" Then
'riproduco un segnale acustico di avviso
Beep
'Popup Message Box si chiuderà automaticamente da solo dopo 2 secondi
strMsg = obj.popUp("Codice di iserimento in F8 non trovato !!!", 2, "Codice", vbOKCancel)
Exit Sub
........ altro codice .......
End Sub |
'In un modulo:
'To display a timed Msgbox use the Msgbox2 routine given below. Note, a demonstration routine can be found at the bottom of this post:
'------------API calls for Msgbox2------------------------
'------------MUST BE PLACED IN A STANDARD MODULE----------
Option Explicit
'API calls for Msgbox2. Must be placed in a standard module
Private Declare Function SetTimer Lib "user32" (ByVal Hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" (ByVal Hwnd As Long, ByVal nIDEvent As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
Private zsMessageTitle As String, lTimerId As Long
'Purpose : Stops the timer routine
'Inputs : N/A
'Outputs : Returns True if the timer routine was stopped
'Author : Andrew Baker
'Date : 15/10/2000 15:24
'Notes : Code must be placed in a module
'Revisions :
Function EndTimer() As Boolean
If lTimerId Then
lTimerId = KillTimer(0&, lTimerId)
lTimerId = 0
EndTimer = True
End If
End Function
'Purpose : Starts the continuous calling of a private routine at a specific time interval.
'Inputs : lInterval The interval (in ms) at which to call the routine
'Outputs : N/A
'Author : Andrew Baker
'Date : 15/10/2000 15:30
'Notes : Code must be placed in a module
'Revisions :
Sub StartTimer(lInterval As Long)
If lTimerId Then
'End Current Timer
EndTimer
End If
lTimerId = SetTimer(0&, 0&, ByVal lInterval, AddressOf TimerRoutine)
End Sub
'Purpose : Routine which is called repeatedly by the timer API.
'Inputs : Inputs are automatically generated.
'Outputs :
'Author : Andrew Baker
'Date : 15/10/2000 15:32
'Notes :
'Revisions :
Private Sub TimerRoutine(ByVal lHwnd As Long, ByVal lMsg As Long, ByVal lIDEvent As Long, ByVal lTime As Long)
Const WM_CLOSE = &H10
Dim lHwndMsgbox As Long
'Find the Msgbox
lHwndMsgbox = FindWindow(vbNullString, zsMessageTitle)
'Close Msgbox
Call SendMessage(lHwndMsgbox, WM_CLOSE, 0, ByVal 0&)
End Sub
'Purpose : Extended version of Msgbox, has extra parameter to set time msgbox is displayed for
'Inputs : As per Msgbox
' [DisplayTime] The time in MS to display the message.
'Outputs : As per Msgbox
'Author : Andrew Baker
'Date : 03/01/2001 13:23
'Notes :
'Revisions :
Function Msgbox2(Prompt As String, Buttons As VbMsgBoxStyle, Title As String, Optional DisplayTime As Long) As VbMsgBoxResult
If DisplayTime > 0 Then
'Enable the timer
StartTimer DisplayTime
zsMessageTitle = Title
End If
Msgbox2 = MsgBox(Prompt, Buttons, Title)
'Stop the timer
EndTimer
End Function
'Demonstration routine
Sub TestMessage()
Dim lRetVal As VbMsgBoxResult
lRetVal = Msgbox2("This message will be displayed for 2 seconds", vbOKCancel + vbInformation, "Test Message", 2000)
Debug.Print lRetVal
End Sub |
Public dTime As Date
Sub ricordami()
On Error Resume Next
dTime = Now + TimeValue("00:00:01")
Application.OnTime dTime, "ricordami"
'Chiudere la cartella di lavoro nel momento specificato
If Time = TimeSerial(18, 30, 0) Then
chiudiCAR
End If
'Impostare promemoria di chiusura ufficio
If Time = TimeSerial(17, 30, 0) Then
Application.OnTime dTime, "chiudiOF"
End If
'impostare promemoria pausa pranzo
If Time = TimeSerial(13, 0, 0) Then
Application.OnTime dTime, "pranzo"
End If
'impostare il promemoria per la pausa caffè
If Time = TimeSerial(11, 15, 0) Then
Application.OnTime dTime, "Pcaffe"
End If
End Sub
------------------------------------------------------------------------------
Sub ricordamiST()
'fermare la procedura ricordami
Application.OnTime dTime, "ricordami", , False
End Sub
Sub chiudiCAR()
On Error Resume Next
ricordamiST
'salva cartella di lavoro prima della chiusura
ThisWorkbook.Save
'chiude la cartella di lavoro
ThisWorkbook.Close
End Sub
Sub Pcaffe()
Dim obj As Object
Dim strMsg As String
Set obj = CreateObject("WScript.Shell")
'riproduco un segnale acustico di avviso
Beep
'Popup Message Box si chiuderà automaticamente da solo
strMsg = obj.Popup("Pausa Caffè!", vbOKCancel)
End Sub
Sub pranzo()
Dim obj As Object
Dim strMsg As String
Set obj = CreateObject("WScript.Shell")
Beep
strMsg = obj.Popup("Pausa Pranzo!", vbOKCancel)
End Sub
Sub chiudiOF()
Dim obj As Object
Dim strMsg As String
Set obj = CreateObject("WScript.Shell")
Beep
strMsg = obj.Popup("Chiudi Ufficio!", vbOKCancel)
End Sub
|
Sub Filtri()
Dim obj As Object
Dim strMsg As String
Set obj = CreateObject("WScript.Shell")
If Range("F8").Value = "non trovato" Then
'riproduco un segnale acustico di avviso
Beep
'Popup Message Box si chiuderà automaticamente da solo dopo 2 secondi
strMsg = obj.popUp("Codice di iserimento in F8 non trovato !!!", 2, "Codice", vbOKCancel)
Exit Sub
........ altro codice .......
End Sub |
