Article ID: 152578
Article Last Modified on 8/17/2005
Sub Check_Spelling_In_Binder()
Dim BindObj As Object
Dim WrdBasic As Object
Dim BindSct
On Error Resume Next
'Create a reference to the Binder
Set BindObj = ActiveWorkbook.Container.Parent
active_section = BindObj.ActiveSection.Name
'Loop through all of the Binder sections.
For Each BindSct In BindObj.sections
BindSct.Activate
'"If" structure to determine type of section
If BindSct.Type Like "Excel.Sheet.*" Then
BindSct.Object.Cells.CheckSpelling _
customdictionary:="custom.dic", _
ignoreuppercase:=False, alwayssuggest:=True
ElseIf BindSct.Type Like "Word.Document.*" Then
' If Word.Basic object not created, create it
If WrdBasic Is Nothing Then Set WrdBasic = _
CreateObject("word.basic")
WrdBasic.toolsspelling
ElseIf BindSct.Type Like "Excel.Chart.*" Then
BindSct.Object.CheckSpelling _
customdictionary:="custom.dic", _
ignoreuppercase:=False, alwayssuggest:=True
Else
'This would be a PowerPoint section.
'No Spell check method in Powerpoint object model.
End If
Next BindSct
'reactivate the section from which this macro was launched
BindObj.sections(active_section).Activate
Set BindObj = Nothing
Set WrdBasic = Nothing
End Sub
Keywords: KB152578