OFF95: Macro to Spell Check a BinderID: Q152578 
  | 
By default, spell checking is not provided across all sections of a binder.
If you want to check the spelling of each section in your binder, you must
first activate each section and then check the spelling while the document
is activated.
This article provides a sample Microsoft Excel Visual Basic for
Applications macro for checking the spelling of all the Microsoft Word and
Microsoft Excel sections in a binder file. Note, since Microsoft PowerPoint
does not have a Spell checking method in its Object model, the macro does
not contain any code to check the spelling of PowerPoint presentations.
Microsoft provides examples of Visual Basic for Applications procedures for
illustration only, without warranty either expressed or implied, including,
but not limited to the implied warranties of merchantability and/or fitness
for a particular purpose. The Visual Basic procedures in this article are
provided 'as is' and Microsoft does not guarantee that they can be used in
all situations. While Microsoft support professionals can help explain the
functionality of a particular macro, they will not modify these examples to
provide added functionality, nor will they help you construct macros to
meet your specific needs. If you have limited programming experience, you
may want to consult one of the Microsoft Solution Providers. Solution
Providers offer a wide range of fee-based services, including creating
custom macros. For more information about Microsoft Solution Providers,
call Microsoft Customer Information Service at (800) 426-9400.
Before entering the sample macro code below, do the following:
    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
   "Microsoft Office for Windows 95 Resource Kit," Chapter 12, "Support and Troubleshooting"
Keywords          : 
Version           : 7.00 7.00a 7.00b
Platform          : WINDOWS 
Issue type        : 
Last Reviewed: June 3, 1999