Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-02-2021, 09:45 PM
stky stky is offline Need to do this for more than 20 styles is any option is there. help me on this Windows 10 Need to do this for more than 20 styles is any option is there. help me on this Office 2013
Advanced Beginner
Need to do this for more than 20 styles is any option is there. help me on this
 
Join Date: Apr 2021
Posts: 30
stky is on a distinguished road
Default 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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to do this for more than 20 styles is any option is there. help me on this Creating buttons for individual paragraph styles on a ribbon tab - not using Quick Styles T7Training Word 11 12-22-2019 12:16 PM
Does a new set of styles in a template overwrite or remove the existing set of styles in a document? dianahbr Word 6 03-27-2018 11:12 PM
Two much blank space between names of styles in the Styles Pane PereCasanellas Word 0 10-06-2017 03:47 AM
Question about spacing between multi-level bullet styles (and other styles) SDwriter Word 0 09-26-2017 09:39 AM
Need to do this for more than 20 styles is any option is there. help me on this Styles: Only this document option jthomas666 Word 1 06-27-2016 12:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:26 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