Spellcheck in Headers and Footers

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

Guest

How do you spellcheck a custom header/footer in 2003? Is it the same in 2007?

Thanks in advance for your help
 
You cannot spellcheck a header or footer in any version AFAIK.

You could use VBA to set a cell value as a header or footer.

Sub CellInFooter()
With ActiveSheet
.PageSetup.CenterFooter = .Range("A1").Value
End With
End Sub

Run spellcheck on the referenced cell after user enters a value.


Gord Dibben MS Excel MVP
 
You can spell check individual words in a macro, though.

This assumes that you have individual words separated by spaces:

Option Explicit
Sub testme()

Dim myHeaderStrings As Variant
Dim myHeaders As Variant
Dim hCtr As Long

With Worksheets("sheet1").PageSetup
Call CheckSpellingOfWord(.LeftHeader)
Call CheckSpellingOfWord(.CenterHeader)
Call CheckSpellingOfWord(.RightHeader)
Call CheckSpellingOfWord(.LeftFooter)
Call CheckSpellingOfWord(.CenterFooter)
Call CheckSpellingOfWord(.RightFooter)
End With

End Sub
Sub CheckSpellingOfWord(myHeader As String)
Dim myHeaderStrings As Variant
Dim hCtr As Long
Dim WordIsOk As Boolean

myHeader = Application.Trim(myHeader)
If myHeader = "" Then
'nothing in this section
Else
myHeaderStrings = Split(myHeader)
For hCtr = LBound(myHeaderStrings) To UBound(myHeaderStrings)
WordIsOk = Application.CheckSpelling(word:=myHeaderStrings(hCtr))
If WordIsOk Then
'skip it
Else
MsgBox "Header/Footer has an error" _
& vbLf & myHeaderStrings(hCtr)
End If
Next hCtr
End If

End Sub


I didn't test it in xl2007, though.
 
Wow! I am always amazed at how much more there always is to learn.

I wonder if for most users it would be easier to set up a template with the
first 4 rows set as print titles for a header with data that they type, for
example, so that spell check would work.

Then the footer could include just field codes (dates, path names, page
numbers), etc.

Your thoughts?
 
Do you mean you're going to create a header with 4 different headers--and the
users can delete the 3 lines that they don't need?

If that's what you mean, then the header/footer dialog isn't very nice to work
with and each has a limit on the amount of text you can put in each section.

If you meant that you're going to put as much info as you need in the headers
and let the users only change the footers, I like that much better.

As a user, anything you (as a developer) can do to make it easier is better for
me <vbg>.
Wow! I am always amazed at how much more there always is to learn.

I wonder if for most users it would be easier to set up a template with the
first 4 rows set as print titles for a header with data that they type, for
example, so that spell check would work.

Then the footer could include just field codes (dates, path names, page
numbers), etc.

Your thoughts?
 
Back
Top