ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open event to call procedure ONLY on Monday (https://www.excelbanter.com/excel-programming/318894-open-event-call-procedure-only-monday.html)

Steph[_3_]

Open event to call procedure ONLY on Monday
 
Hello everyone. I would like to create a workbook open event that calls a
procedure within the same workbook ONLY if the workbook is opened on a
Monday. All other days the open event would call nothing. Is this
possible? Thanks!



Harald Staff

Open event to call procedure ONLY on Monday
 
Private Sub Workbook_Open()
If Weekday(Date, vbMonday) = 1 Then
Call DramaticMacro
End If
End Sub

HTH. Best wishes Harald

"Steph" skrev i melding
...
Hello everyone. I would like to create a workbook open event that calls a
procedure within the same workbook ONLY if the workbook is opened on a
Monday. All other days the open event would call nothing. Is this
possible? Thanks!





R. Choate

Open event to call procedure ONLY on Monday
 
Have you considered using the WEEKDAY worksheet function in your worksheet_open event? You would put this in the "ThisWorkbook"
module. Your code would start with:

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)

dyDay = Weekday(Now(), 1)
If dyDay = 2 Then
' some code here
End If

End Sub

--
RMC,CPA


"Steph" wrote in message ...
Hello everyone. I would like to create a workbook open event that calls a
procedure within the same workbook ONLY if the workbook is opened on a
Monday. All other days the open event would call nothing. Is this
possible? Thanks!





All times are GMT +1. The time now is 11:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com