Open event to call procedure ONLY on Monday

  • Thread starter Thread starter Steph
  • Start date Start date
S

Steph

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!
 
Private Sub Workbook_Open()
If Weekday(Date, vbMonday) = 1 Then
Call DramaticMacro
End If
End Sub

HTH. Best wishes Harald
 
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


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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top