Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
jat jat is offline
external usenet poster
 
Posts: 33
Default code to prevent users from adding new worksheets

i want to prevent users from adding new or blank worksheets on a form, but i
cannot get the code below to work:

Private Sub Workbook_NewSheet(ByVal Sh As Object)
If Not BlockInsertSheet Then Exit Sub
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Sh.Delete
With Application
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub


i have te code in the Microsoft Excel Objects, This Workbook module but i
cannot get it to work. what's missing?

jat

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default code to prevent users from adding new worksheets

Hi,

Try this. Double click 'ThisWorkbook' and paste this in on the right

Private Sub Workbook_NewSheet(ByVal Sh As Object)
Application.DisplayAlerts = False
MsgBox "No new sheets thank you"
Sh.Delete
Application.DisplayAlerts = True
End Sub


Mike

"jat" wrote:

i want to prevent users from adding new or blank worksheets on a form, but i
cannot get the code below to work:

Private Sub Workbook_NewSheet(ByVal Sh As Object)
If Not BlockInsertSheet Then Exit Sub
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Sh.Delete
With Application
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub


i have te code in the Microsoft Excel Objects, This Workbook module but i
cannot get it to work. what's missing?

jat

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 492
Default code to prevent users from adding new worksheets

You can do that by password protecting the workbook,
Regards,
Alan.
"jat" wrote in message
...
i want to prevent users from adding new or blank worksheets on a form, but
i
cannot get the code below to work:

Private Sub Workbook_NewSheet(ByVal Sh As Object)
If Not BlockInsertSheet Then Exit Sub
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Sh.Delete
With Application
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub


i have te code in the Microsoft Excel Objects, This Workbook module but i
cannot get it to work. what's missing?

jat


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
Prevent users from adding rows in Excel 2000 ALEX Excel Discussion (Misc queries) 4 October 10th 06 05:18 PM
Prevent wandering users cindee Excel Discussion (Misc queries) 2 October 5th 05 08:20 PM
Prevent users from copying worksheets LISACOMOP Excel Discussion (Misc queries) 3 August 24th 05 11:15 PM
prevent users from overwriting other users data [email protected] Excel Worksheet Functions 0 April 17th 05 08:18 PM
Help - Automating a file.. Adding Users , Deleting users, Changing Tim Harding Excel Worksheet Functions 0 March 16th 05 01:25 PM


All times are GMT +1. The time now is 02:52 AM.

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"