dialog box

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

Guest

How do I have a "message box" (I think thats what I want) automaticly open and dispaly the following message "Do not modify data in columns a-g" everytime someone opens a certain Excel Spreadsheet?
 
Jason, this will do it

Private Sub Workbook_Open()
MsgBox "Do not modify data in columns a-g"
End Sub

To put in this macro, from your workbook right-click the workbook's icon and
pick View Code. This icon is to the left of the "File" menu this will open
the VBA editor, in the left hand window double click on thisworkbook, under
your workbook name, and paste the code in the window that opens on the right
hand side, press Alt and Q to close this window and go back to your
workbook, now this will run every time you open the workbook. If you are
using excel 2000 or newer you may have to change the macro security
settings to get the macro to run.

--
Paul B
Always backup your data before trying something new
Using Excel 97 & 2000
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **

jason hope said:
How do I have a "message box" (I think thats what I want) automaticly open
and dispaly the following message "Do not modify data in columns a-g"
everytime someone opens a certain Excel Spreadsheet?
 
Jason,

Include the following code in the open event of the
workbook:

Private Sub Workbook_Open()
MsgBox ("Do not modify data in columns a-g")
End Sub

To do this right click on any sheet tab and select View
code.
Paste the code in the VB editor.
Close the VB editor and save your file.

Note: users will have to enable macros to view this
message.
Regards,
Felipe
-----Original Message-----
How do I have a "message box" (I think thats what I want)
automaticly open and dispaly the following message "Do not
modify data in columns a-g" everytime someone opens a
certain Excel Spreadsheet?
 
Using the worksheet_activate in that sheet

Private Sub Worksheet_Activate()
r=msgbox("Do not enter data in columns a-g", _
Vbokonly+vbexclamation,"Info")
End Sub
-----Original Message-----
How do I have a "message box" (I think thats what I want)
automaticly open and dispaly the following message "Do not
modify data in columns a-g" everytime someone opens a
certain Excel Spreadsheet?
 
Jason,

You're a trusting soul. Even if the user doesn't disable macros, reads your
nice message, and even takes it to heart, he may still accidentally clobber
the stuff in columns a-g. The more typical way to handle this is to
disallow entry by locking the cells (they're already locked, and you can
unlock other cells into which data entry IS to be allowed with Format -
Cells - Protection), then protecting the sheet (Tools - Protection - Protect
sheet).

Or you can totally disallow entry with Data Validation - Custom, using this
formula:

="Pigs" = "Fly"

You can put your nice message that will appear when a feckless user attempts
to type stuff into a cell. SOmething like:

"You moron, didn't you read the message?
You can't type anything into these cells. Go away."

You can also put an input message that pops up any time the user so much as
just selects one of the restricted cells:

"Don't type on me."

Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

jason hope said:
How do I have a "message box" (I think thats what I want) automaticly open
and dispaly the following message "Do not modify data in columns a-g"
everytime someone opens a certain Excel Spreadsheet?
 
Back
Top