View Single Post
 
Old 03-14-2023, 07:26 AM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Perhaps:

Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oStyle As Style, oStyleValidate As Style
Dim oDocValidate As Document
Dim oTmp As Template
  Set oTmp = ActiveDocument.AttachedTemplate
  Set oDocValidate = oTmp.OpenAsDocument
  Set oStyle = ActiveDocument.Styles("Style1")
  For Each oStyle In ActiveDocument.Styles
    On Error Resume Next
    Set oStyleValidate = oDocValidate.Styles(oStyle.NameLocal)
    If Err.Number <> 0 Then
      oStyle.Delete
      Err.Clear
    End If
  Next oStyle
  oDocValidate.Close wdDoNotSaveChanges
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote