Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Spell Checking on a protected sheet

Hi Folks,

I have a sheet that is protected, and have the following code on a
control_click event to allow spell checking. It unprotects the sheet, runs
the spelling check function, then re-protects the sheet with the original
password. It also allows row height to be formatted when the sheet is
protected.

Private Sub SpellCheck_Click()

ActiveSheet.Unprotect Password:="Password"
Cells.CheckSpelling _
CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, _
AlwaysSuggest:=True
ActiveSheet.Protect Password:="Password"
' Allow rows to be formatted (autofit) on a protected worksheet.
If ActiveSheet.Protection.AllowFormattingRows = False Then
ActiveSheet.Protect AllowFormattingRows:=True
End If
End Sub

This works fine if there is at least one spelling error. However, if there
are zero errors on the sheet, then this code re-protects the sheet without a
password. Any user can run the spell checker to remove the password, then
just unprotect the sheet.

Any suggestions on how to fix this? I'd like to allow users to run spell
checking and adjust row height, but I want it to stay password protected too!

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Spell Checking on a protected sheet


Thats simply because you have the PROTECT code within the IF statement,
put it after the END IF and all should be fine.


mooresk257;661544 Wrote:

Hi Folks,

I have a sheet that is protected, and have the following code on a
control_click event to allow spell checking. It unprotects the sheet,
runs
the spelling check function, then re-protects the sheet with the
original
password. It also allows row height to be formatted when the sheet is
protected.

Private Sub SpellCheck_Click()

ActiveSheet.Unprotect Password:="Password"
Cells.CheckSpelling _
CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, _
AlwaysSuggest:=True
ActiveSheet.Protect Password:="Password"
' Allow rows to be formatted (autofit) on a protected worksheet.
If ActiveSheet.Protection.AllowFormattingRows = False Then
ActiveSheet.Protect AllowFormattingRows:=True
End If
End Sub

This works fine if there is at least one spelling error. However, if
there
are zero errors on the sheet, then this code re-protects the sheet
without a
password. Any user can run the spell checker to remove the password,
then
just unprotect the sheet.

Any suggestions on how to fix this? I'd like to allow users to run
spell
checking and adjust row height, but I want it to stay password
protected too!

Thanks!


--
Simon Lloyd

Regards,
Simon Lloyd
'Excel Chat' (http://www.thecodecage.com/forumz/chat.php)
------------------------------------------------------------------------
Simon Lloyd's Profile: 1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=184741

Excel Live Chat

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Spell Checking on a protected sheet


You also have this:


VBA Code:
--------------------


If ActiveSheet.Protection.AllowFormattingRows = False Then
ActiveSheet.Protect AllowFormattingRows:=True
End If

--------------------


Which is protecting without a password, it should read



VBA Code:
--------------------


If ActiveSheet.Protection.AllowFormattingRows = False Then
ActiveSheet.Protect Password:="password", AllowFormattingRows:=True
End If

--------------------






mooresk257;661544 Wrote:

Hi Folks,

I have a sheet that is protected, and have the following code on a
control_click event to allow spell checking. It unprotects the sheet,
runs
the spelling check function, then re-protects the sheet with the
original
password. It also allows row height to be formatted when the sheet is
protected.

Private Sub SpellCheck_Click()

ActiveSheet.Unprotect Password:="Password"
Cells.CheckSpelling _
CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, _
AlwaysSuggest:=True
ActiveSheet.Protect Password:="Password"
' Allow rows to be formatted (autofit) on a protected worksheet.
If ActiveSheet.Protection.AllowFormattingRows = False Then
ActiveSheet.Protect AllowFormattingRows:=True
End If
End Sub

This works fine if there is at least one spelling error. However, if
there
are zero errors on the sheet, then this code re-protects the sheet
without a
password. Any user can run the spell checker to remove the password,
then
just unprotect the sheet.

Any suggestions on how to fix this? I'd like to allow users to run
spell
checking and adjust row height, but I want it to stay password
protected too!

Thanks!


--
Simon Lloyd

Regards,
Simon Lloyd
'Excel Chat' (http://www.thecodecage.com/forumz/chat.php)
------------------------------------------------------------------------
Simon Lloyd's Profile: 1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=184741

Excel Live Chat

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Spell Checking on a protected sheet

Thanks for your help - problem solved!

This was how I re-wrote the code with your suggestions:

Private Sub SpellCheck_Click()

ActiveSheet.Unprotect Password:="0000"
Cells.CheckSpelling _
CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, _
AlwaysSuggest:=True
' Allow rows to be formatted (autofit) on a protected worksheet.
If ActiveSheet.Protection.AllowFormattingRows = False Then
ActiveSheet.Protect Password:="0000", AllowFormattingRows:=True
End If
ActiveSheet.Protect Password:="0000"

End Sub

"Simon Lloyd" wrote:


You also have this:



VBA Code:
--------------------



If ActiveSheet.Protection.AllowFormattingRows = False Then
ActiveSheet.Protect AllowFormattingRows:=True
End If


--------------------


Which is protecting without a password, it should read




VBA Code:
--------------------



If ActiveSheet.Protection.AllowFormattingRows = False Then
ActiveSheet.Protect Password:="password", AllowFormattingRows:=True
End If


--------------------







mooresk257;661544 Wrote:

Hi Folks,

I have a sheet that is protected, and have the following code on a
control_click event to allow spell checking. It unprotects the sheet,
runs
the spelling check function, then re-protects the sheet with the
original
password. It also allows row height to be formatted when the sheet is
protected.

Private Sub SpellCheck_Click()

ActiveSheet.Unprotect Password:="Password"
Cells.CheckSpelling _
CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, _
AlwaysSuggest:=True
ActiveSheet.Protect Password:="Password"
' Allow rows to be formatted (autofit) on a protected worksheet.
If ActiveSheet.Protection.AllowFormattingRows = False Then
ActiveSheet.Protect AllowFormattingRows:=True
End If
End Sub

This works fine if there is at least one spelling error. However, if
there
are zero errors on the sheet, then this code re-protects the sheet
without a
password. Any user can run the spell checker to remove the password,
then
just unprotect the sheet.

Any suggestions on how to fix this? I'd like to allow users to run
spell
checking and adjust row height, but I want it to stay password
protected too!

Thanks!


--
Simon Lloyd

Regards,
Simon Lloyd
'Excel Chat' (http://www.thecodecage.com/forumz/chat.php)
------------------------------------------------------------------------
Simon Lloyd's Profile: 1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=184741

Excel Live Chat

.

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
Spell Checking on a protected sheet mooresk257 Excel Programming 5 June 3rd 09 10:43 AM
spell check on protected sheet spell check on protected sheet Excel Discussion (Misc queries) 2 September 30th 08 04:45 PM
Spell checking a protected worksheet Trevor Excel Discussion (Misc queries) 0 February 14th 07 07:25 AM
How can I use spell checking in a protected worksheet? Deb from MA Excel Worksheet Functions 1 April 24th 06 06:40 PM
Spell checking a protected sheet bjshots Excel Programming 0 June 16th 04 05:40 AM


All times are GMT +1. The time now is 08:27 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"