LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Printing with restrictions - VB

Perhaps

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Const sPWORD As String = "autpbg1"
Dim ws As Worksheet
Dim vCheck As Variant
Dim i As Long
Dim nAddr As Long
Dim nMsg As Long

vCheck = Array( _
Array("K7", "a date in 'Request Date' field"), _
Array("K11", _
"to choose a Mgr. from the 'Mgr. Approval' dropdown list"), _
Array("K14", _
"an amount in the 'Total Amount to be Reallocated' field"), _
Array("D26", "a number in the 'Receipt Number'"))

nAddr = LBound(vCheck)
nMsg = nAddr + 1

With Sheets("Receipt to Receipt")
For i = LBound(vCheck) To UBound(vCheck)
Cancel = Trim(.Range(vCheck(i)(nAddr)).Text) = vbNullString
If Cancel Then
MsgBox "You need " & vCheck(i)(nMsg) & _
" before printing!"
Exit For
End If
Next i
If Not Cancel Then
.Unprotect Password:=sPWORD
With .Range("A18:C18, A19:S48, G6:S15,N5:S5")
.Interior.ColorIndex = xlColorIndexNone
On Error Resume Next
Application.EnableEvents = False
.Parent.PrintOut
Application.EnableEvents = True
On Error GoTo 0
.Interior.ColorIndex = 37
End With
.Protect Password:=sPWORD
End If
End With
Cancel = True
End Sub



In article ,
pgarcia wrote:

Sir, could you help me with one more thing? Thanks

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restrictions in format juanpablo Excel Discussion (Misc queries) 1 April 27th 10 06:15 PM
RESTRICTIONS YESHWANT JOSHI Excel Discussion (Misc queries) 5 May 26th 09 05:02 PM
Printing with restrictions - VB pgarcia Excel Discussion (Misc queries) 9 September 25th 07 07:14 PM
How to do look up with restrictions JackR Excel Discussion (Misc queries) 3 April 3rd 06 01:12 AM
get_Range Restrictions.. Edi Excel Programming 4 July 14th 05 08:39 AM


All times are GMT +1. The time now is 12:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"