Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default NOOB: Can someone write me some code?

I need a code that will prevent printing or saving nless all fields
are filled in.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Can someone write me some code?

All what fields? Cells on a spreadsheet (if so, which ones)? TextBoxes on a
UserForm (how many)? Something else (describe what)?

--
Rick (MVP - Excel)


wrote in message
...
I need a code that will prevent printing or saving nless all fields
are filled in.

Thanks!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,344
Default NOOB: Can someone write me some code?

Hi,

You need to add the code to the Workbook_BeforePrint event and the
Workbook_BeforeSave event.

The interior code would be the same:
IF Range("A1")="" then
msgbox "Data is missing from cell A1."
Cancel=True
end if

You would need to add this for all the ranges that might be missing data, if
those ranges are contigious, for example A1:A100 then

For Each cell in Range("A1:A100")
If cell="" Then
Beep
MsgBox "whatever message you want here."
Cancel=True
Exit For
End if
Next cell
--
Thanks,
Shane Devenshire


" wrote:

I need a code that will prevent printing or saving nless all fields
are filled in.

Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default NOOB: Can someone write me some code?

use the follow events,add some judge codes
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

End Sub

Private Sub Workbook_BeforePrint(Cancel As Boolean)

End Sub



写入消息
...
I need a code that will prevent printing or saving nless all fields
are filled in.

Thanks!


Reply
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
Write VB6 code to be used with VBA avi Excel Programming 1 April 8th 07 02:32 PM
Write Code w/VBA Ronbo Excel Programming 2 May 23rd 06 08:54 PM
Write code to Write Code Kstalker[_43_] Excel Programming 6 November 25th 05 12:30 AM
Code to write out all lines of code davidm Excel Programming 3 August 5th 05 04:26 AM
How can i write TSR code A-Design Excel Programming 5 September 29th 04 05:26 PM


All times are GMT +1. The time now is 03:28 PM.

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

About Us

"It's about Microsoft Excel"