denismccarthy
Board Regular
- Joined
- Dec 30, 2006
- Messages
- 108
Hi,
I want to run a macro at a certain time, which I have the code. My question is how do I get the macro to run 15mins later if a certain criteria isn't met and to check ever 15 mins until criteria is met. Basically I want to check a date on a database to see if the day as moved on, which I'll be doing with a SQL line. Below is just a sample code I'm testing at home. I don't have SQL line as I'm not in work. Thanks for any help.
Private Sub Workbook_Open()
Application.OnTime TimeValue("13:21:00"), "MyMacro"
End Sub
Sub MyMacro()
'
' Macro1 Macro
' Macro recorded 15/06/2008 by McCarthy Family
'
'On Error Resume Next
Sheets("sheet1").Select
Range("a1").Select
Selection = "It works"
Dim rspCreate
If Dir("c:/test/", vbDirectory) = "" Then
MkDir "c:/test/"
End If
'
End Sub
I want to run a macro at a certain time, which I have the code. My question is how do I get the macro to run 15mins later if a certain criteria isn't met and to check ever 15 mins until criteria is met. Basically I want to check a date on a database to see if the day as moved on, which I'll be doing with a SQL line. Below is just a sample code I'm testing at home. I don't have SQL line as I'm not in work. Thanks for any help.
Private Sub Workbook_Open()
Application.OnTime TimeValue("13:21:00"), "MyMacro"
End Sub
Sub MyMacro()
'
' Macro1 Macro
' Macro recorded 15/06/2008 by McCarthy Family
'
'On Error Resume Next
Sheets("sheet1").Select
Range("a1").Select
Selection = "It works"
Dim rspCreate
If Dir("c:/test/", vbDirectory) = "" Then
MkDir "c:/test/"
End If
'
End Sub