Need to do this for more than 20 styles is any option is there. help me on this
Sub test_style_exists()
Dim test_style As String
On Error Resume Next
test_style = "Quota"
MsgBox "Style " & test_style & " exists in " & ActiveDocument.Name & "?" & vbCr & _
style_exists(ActiveDocument, test_style)
If Not MyStyle Is Nothing Then
Set MyStyle = Application.ActiveDocument.Styles.Add(test_style, wdStyleTypeParagraph)
End If
End Sub
Function style_exists(test_document As Word.Document, style_name As String) As Boolean
style_exists = False
On Error Resume Next
style_exists = test_document.Styles(style_name).NameLocal = style_name
End Function
|