View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Still stumped with printing macro

This should do what you want:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
dim sPassword as String

sPassword = InputBox("Enter the password")
if Not sPassword = "WhatEverThePasswordIs" Then
Cancel = True
MsgBox "Information contained in this workbook cannot be printed"
Else
ActiveSheet.PrintOut
End If
End Sub

Regards,
GS