Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-21-2023, 12:41 PM
Ulodesk Ulodesk is offline Compile error -- incompatibility? Windows 10 Compile error -- incompatibility? Office 2021
Word 2013 Expert Cert
Compile error -- incompatibility?
 
Join Date: Sep 2009
Location: Virginia
Posts: 872
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile error on hidden module Simss Excel Programming 2 09-25-2017 01:37 AM
compile error expected end sub ashg75 Word VBA 2 07-13-2017 07:08 AM
Compile error -- incompatibility? Compile error in Module ksigcajun Word VBA 2 04-08-2015 06:44 AM
Compile error: sub or function not defined.. xena2305 Excel Programming 0 08-02-2011 10:17 AM
compile error in Word raco Word 0 09-28-2010 12:40 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:13 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft