Spell Check

W

Warm

Hi,

can someone please explain why this proction macro does not allow the spell
check function to work when the 'userinterfaceonly' option is in it?!

Sub ProtectAll()

Dim sPassword As String
sPassword = "LMW5487"

If Application.InputBox( _
Prompt:="Please enter the password", _
Title:="Password", _
Type:=2) <> sPassword Then

MsgBox "Wrong password!"
Exit Sub

End If

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Protect Password:="sPassword", AllowFormattingCells:=True, _
Contents:=True, Scenarios:=True, userinterfaceonly:=True

Next ws

End Sub
 
M

Mike H

Hi,

using userinterfaceonly simply means that you can change a protected sheet
using VB and if you want to spell check using code you can but won't be able
to do it from the worksheet menu.

To check using code do something like

Cells.CheckSpelling SpellLang:=1033

Mike
 
W

Warm

Hi,
it still does not check the spelling, is there any particular place i need
to add it in?
 
G

Gord Dibben

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Protect Password:="sPassword", AllowFormattingCells:=True, _
Contents:=True, Scenarios:=True, userinterfaceonly:=True
Cells.CheckSpelling SpellLang:=1033

Next ws



Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top