ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Spellcheck in Headers and Footers (https://www.excelbanter.com/excel-discussion-misc-queries/158417-spellcheck-headers-footers.html)

Allison

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

Thanks in advance for your help
--
Thanks, Allison

Gord Dibben

Spellcheck in Headers and Footers
 
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

On Sat, 15 Sep 2007 07:08:01 -0700, Allison
wrote:

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

Thanks in advance for your help



Allison

Spellcheck in Headers and Footers
 
Thanks! I appreciate the response. Allison
--
Thanks, Allison


"Gord Dibben" wrote:

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

On Sat, 15 Sep 2007 07:08:01 -0700, Allison
wrote:

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

Thanks in advance for your help




Dave Peterson

Spellcheck in Headers and Footers
 
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(hC tr))
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.

Allison wrote:

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

Thanks in advance for your help
--
Thanks, Allison


--

Dave Peterson

Allison

Spellcheck in Headers and Footers
 
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?
--
Thanks, Allison


"Dave Peterson" wrote:

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(hC tr))
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.

Allison wrote:

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

Thanks in advance for your help
--
Thanks, Allison


--

Dave Peterson


Dave Peterson

Spellcheck in Headers and Footers
 
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.

Allison wrote:

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?
--
Thanks, Allison

"Dave Peterson" wrote:

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(hC tr))
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.

Allison wrote:

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

Thanks in advance for your help
--
Thanks, Allison


--

Dave Peterson


--

Dave Peterson


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com