Printing, VB - based on dates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a workbook with several worksheets that I let my officemates use.
However, when they are done with their work using my workbook, they cannot
print any of the worksheets so I have to print it for them.

Is there a way that I can let them print based on:
1. Day, say on 8-16-07 or
2. a week, say from 8-20-07 to 8-24?

Please help modify the macro below or help me write a macro.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
End Sub

Thank you.
 
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Date <> VBA.DateSerial(2007,8,16) Then
Cancel = True
End If
End Sub

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000
 
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Date < DateSerial(2007,8,20) Or _
Date > DateSerial(2007,8,24) Then
Cancel = True
End If
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
It worked perfectly! Thanks a lot gentlemen.

Bob Phillips said:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Date < DateSerial(2007,8,20) Or _
Date > DateSerial(2007,8,24) Then
Cancel = True
End If
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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