PC Review


Reply
Thread Tools Rate Thread

including macro in protected worksheet

 
 
Sandi Bredahl
Guest
Posts: n/a
 
      8th May 2012
I have an excel 2007 spreadsheet that is protected. I found the
following macro that will allow other people to run spell check:

Sub Macro1()
Dim WS As Worksheet
Application.ScreenUpdating = False
For Each WS In ActiveWorkbook.Worksheets
WS.Select
ActiveSheet.Unprotect Password:="password"
Cells.CheckSpelling SpellLang:=1033
ActiveSheet.Protect Password:="password"
Next WS
Application.ScreenUpdating = True
End Sub

It unlocks file, runs spell check and locks file no problem. I save
the file as an Excel-Enabled worksheet - and expected the macro to
magically be included with the spreadsheet to whoever's computer and
work just as flawlessly.

I thought that when the "other" person opens the file, they would get
a security message that would give them the option of running the
macro. BUT IT DOESN'T! And the macro isn't with the file anymore.

Please help. What did I do wrong. This is driving me nuts.
 
Reply With Quote
 
 
 
 
GS
Guest
Posts: n/a
 
      8th May 2012
Where in the workbook did you put the macro?
How do users access the macro to run it?

Since all workbooks with macros must be saved as either XLSM or XLSA, I
assume you meant you saved it as a Macro-Enabled workbook (XLSM)!

In order to use the macro on other machines, Macro Security must be set
at least to 'Medium' level with notification option for users to
allow/disallow macros when the file is opened.

If the following macro is stored in a standard module then it can be
run via the Macros dialog...

Sub RunSpellCheck()
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
With wks
.Unprotect Password:= "" '//enter your password
.Cells.CheckSpelling SpellLang:=1033
.Protect Password:= "" '//enter your password
End With 'wks
Next 'wks
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


 
Reply With Quote
 
 
 
 
Gord Dibben
Guest
Posts: n/a
 
      8th May 2012
Your code does not unlock any file...........it unprotects each
worksheet in a workbook and runs a spellcheck on that worksheet then
re-protects.

In the original workbook where did you store the macro?

In a general module?

You sure you saved as a macro-enabled workbook and that workbook is
available to others?

What are the macro security settings on the "others" computers?

Should be set to "disable with notification".


Gord

On Tue, 8 May 2012 07:22:23 -0700 (PDT), Sandi Bredahl
<(E-Mail Removed)> wrote:

>I have an excel 2007 spreadsheet that is protected. I found the
>following macro that will allow other people to run spell check:
>
>Sub Macro1()
> Dim WS As Worksheet
> Application.ScreenUpdating = False
> For Each WS In ActiveWorkbook.Worksheets
> WS.Select
> ActiveSheet.Unprotect Password:="password"
> Cells.CheckSpelling SpellLang:=1033
> ActiveSheet.Protect Password:="password"
> Next WS
> Application.ScreenUpdating = True
>End Sub
>
>It unlocks file, runs spell check and locks file no problem. I save
>the file as an Excel-Enabled worksheet - and expected the macro to
>magically be included with the spreadsheet to whoever's computer and
>work just as flawlessly.
>
>I thought that when the "other" person opens the file, they would get
>a security message that would give them the option of running the
>macro. BUT IT DOESN'T! And the macro isn't with the file anymore.
>
>Please help. What did I do wrong. This is driving me nuts.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copying worksheet including graphs to new worksheet leif Microsoft Excel Misc 9 7th Mar 2010 05:03 AM
including entire worksheet sort in a macro PatD Microsoft Excel Misc 2 10th Jul 2009 06:40 PM
Edit text format in non-protected cells in protected worksheet Bonnie Microsoft Excel Misc 1 19th Apr 2008 04:48 PM
Problem with protected Excel worksheet in protected Word document =?Utf-8?B?QW50aG9ueSBUcmF2aXM=?= Microsoft Excel Crashes 0 25th Jan 2005 08:21 PM
Problem with protected Excel worksheet in protected Word document =?Utf-8?B?YW50aG9ueXRyYXZpc0BSRU1PVkVfVEhJU19TVFVG Microsoft Excel Crashes 0 25th Jan 2005 07:49 PM


Features
 

Advertising
 

Newsgroups
 


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