When I run the following code in my Excel 2003 workbook, it tells me that macros RefreshQueries and SaveAndClose cannot be found, but they're within the same workbook??
Any help appreciated.
1 |
Public Refreshed |
2 |
Private Sub RefreshQueries() |
3 |
ActiveWorkbook.RefreshAll |
4 |
Refreshed = True |
5 |
End Sub |
6 |
Private Sub SaveAndConfirm() |
7 |
thisMonth = Month(Now()) |
8 |
thisYear = Year(Now()) |
9 |
If Refreshed = True Then |
10 |
ActiveWorkbook.Save |
11 |
ActiveWorksheet.SendMail "me@somewhere.com", "Dental Incentive Gift Cards - " & thisMonth & " " & thisYear, "false" |
12 |
Else |
13 |
ActiveWorksheet.SendMail "me@somewhere.com", "Dental Incentive Gift Cards - " & thisMonth & " " & thisYear & " failed to refresh", "false" |
14 |
End If |
15 |
ActiveWorkbook.Close |
16 |
End Sub |
17 |
Private Sub Workbook_Open() |
18 |
Refreshed = False |
19 |
Application.OnTime Now + TimeValue("00:00:10"), "RefreshQueries()" |
20 |
Application.OnTime Now + TimeValue("00:01:00"), "SaveAndConfirm()" |
21 |
End Sub |
22 |
|