View Single Post
 
Old 03-21-2023, 12:41 PM
Ulodesk Ulodesk is offline Windows 10 Office 2021
Word 2013 Expert Cert
 
Join Date: Sep 2009
Location: Virginia
Posts: 866
Ulodesk is on a distinguished road
Default Compile error -- incompatibility?

I am not a coder. I've into a problem with a colleague after walking him through installation of a macro over the phone.

When he runs it, he's getting a message of a compile error and "Method or data member not found." In VB, the first line, with the macro name, is highlighted with a yellow pointer, and teh line ".NumberSpacing = wdNumberSpacingDefault" is highlighted in blue.

He is using Word 2007. Could this be a compatibility error?

Here is the code:
Code:
Sub EIRPreEdit()
'
' Macro to format the entire document to Times New Roman 14 pt 6/6, single space, left-aligned
' replace straight single and double straight quotes with curly, and transpose commas and periods to inside of close quote
' remove tabs;
' replace two or more consecutive character spaces with a single one
' replace manual line returns with hard returns; and
' remove empty paragraphs
'
'
       Selection.WholeStory
    With Selection.Font
        .Name = "Times New Roman"
        .Color = wdColorAutomatic
        .Size = 14
        .Spacing = 0
        .Scaling = 100
        .Position = 0
        .Kerning = 0
        .NumberSpacing = wdNumberSpacingDefault
        .NumberForm = wdNumberFormDefault
        .StylisticSet = wdStylisticSetDefault
        .ContextualAlternates = 0

With Selection.ParagraphFormat
        .LeftIndent = InchesToPoints(0)
        .RightIndent = InchesToPoints(0)
        .SpaceBefore = 6
        .SpaceBeforeAuto = False
        .SpaceAfter = 6
        .SpaceAfterAuto = False
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphLeft
        .Hyphenation = True
        .FirstLineIndent = InchesToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
        .CharacterUnitLeftIndent = 0
        .CharacterUnitRightIndent = 0
        .CharacterUnitFirstLineIndent = 0
        .LineUnitBefore = 0
        .LineUnitAfter = 0
        .CollapsedByDefault = False
    End With
    
    With Selection.Find
        .Text = "^t"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    
        .Text = "'"
        .Replacement.Text = "'"
        .Forward = True
        .Wrap = wdFindContinue
    Selection.Find.Execute Replace:=wdReplaceAll

        .Text = """"
        .Replacement.Text = """"
        .Forward = True
        .Wrap = wdFindContinue
    Selection.Find.Execute Replace:=wdReplaceAll
 
        .Text = ""","
        .Replacement.Text = ","""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchWildcards = False
    Selection.Find.Execute Replace:=wdReplaceAll

        .Text = "',"
        .Replacement.Text = ",'"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
    Selection.Find.Execute Replace:=wdReplaceAll

        .Text = """."
        .Replacement.Text = "."""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchWildcards = False
    Selection.Find.Execute Replace:=wdReplaceAll

        .Text = "'."
        .Replacement.Text = ".'"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
    Selection.Find.Execute Replace:=wdReplaceAll

        .Text = "[^l]{1,}"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchWildcards = True
    Selection.Find.Execute Replace:=wdReplaceAll


        .Text = "--"
        .Replacement.Text = "^+"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
    Selection.Find.Execute Replace:=wdReplaceAll
    
        .Format = False
        .Forward = True
        .Wrap = wdFindContinue
        .MatchWildcards = False
        .Replacement.Text = "^+"
        .Text = " ^+"
        .Execute Replace:=wdReplaceAll
        .Text = "^+ "
        .Execute Replace:=wdReplaceAll

        .Text = "[^s]{1,}"
        .Replacement.Text = " "
        .Forward = True
        .Wrap = wdFindContinue
        .MatchWildcards = True
    Selection.Find.Execute Replace:=wdReplaceAll

        .Text = "[^13]{2,}"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .MatchWildcards = True
    Selection.Find.Execute Replace:=wdReplaceAll

        .Text = "([^13] [^13]){1,}"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .MatchWildcards = True
    Selection.Find.Execute Replace:=wdReplaceAll

        .Text = "[ ]{2,}"
        .Replacement.Text = " "
        .Forward = True
        .Wrap = wdFindContinue
        .MatchWildcards = True
    Selection.Find.Execute Replace:=wdReplaceAll
    End With
End With
End Sub
Reply With Quote