RE:macro para una hora concreta
me funciona bien, pero si quiero k se ejecuten 2 macros diferentes a horas diferentes ?
he intentado crear 2 pero no me funciona, quizas de uno agregar un poco mas para hacer 2 y no como he hecho yo hacer 2 enteros.
Option Explicit
Option Private Module
'//By JuanC - 20 de Agosto 2007
'//Observaciones: el archivo debe estar abierto
'// antes de las 10am y hasta por lo
'// menos las 10:01am
Private Declare Function apiSetTimer Lib "user32" Alias "SetTimer" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function apiKillTimer Lib "user32" Alias "KillTimer" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Private lTimerID As Long
Sub pruebas()
Range("C4:D4").Select
Selection.Copy
Range("C2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("D4").Select
Application.CutCopyMode = False
Selection.Copy
Range("D2").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("C2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Empresa"
Range("D2").Select
End Sub
Private Sub TimerCallBack(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)
Dim H As Date
On Error Resume Next
H = Format(Time, "Hh:Mm:SsAM/PM")
If H >= CDate("07:25:00AM") Then
Call apiKillTimer(0, lTimerID)
If H <= CDate("07:26:00AM") Then
Call pruebas
End If
End If
End Sub
Sub auto_open()
On Error Resume Next
lTimerID = apiSetTimer(0, 0, 1000, AddressOf TimerCallBack)
End Sub
Sub auto_close()
On Error Resume Next
Call apiKillTimer(0, lTimerID)
On Error GoTo 0
End Sub
este es uno k llama a una macro k se dice: pruebas
pero para hacer otro a las ... por ejemplo a las 09:00 para k llame a una macro k
se llame: a_las_09_00