Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2021, 08:46 AM
stky stky is offline need to find and create style Windows 10 need to find and create style Office 2013
Advanced Beginner
need to find and create style
 
Join Date: Apr 2021
Posts: 30
stky is on a distinguished road
Default need to find and create style

Hi



I Need to Find a Couple of TAG <S1>, <S2>, <S3>...etc.

If find the tags in the document need to create a style as S1, S2, S3...etc. without losing format.

If TAG not found, NO tags Found as a MSG is this possible.
Reply With Quote
  #2  
Old 04-23-2021, 10:15 PM
macropod's Avatar
macropod macropod is offline need to find and create style Windows 10 need to find and create style Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your description is rather vague. How is one supposed to know what the attributes of the Style might be?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-23-2021, 10:35 PM
stky stky is offline need to find and create style Windows 10 need to find and create style Office 2013
Advanced Beginner
need to find and create style
 
Join Date: Apr 2021
Posts: 30
stky is on a distinguished road
Default I upload Sample Files

Hi

I have uploaded Input File and Style File.
Attached Files
File Type: docx WithOutStyleFile.docx (14.1 KB, 21 views)
File Type: docx StyleWordFile.docx (14.1 KB, 9 views)
Reply With Quote
  #4  
Old 04-23-2021, 10:51 PM
macropod's Avatar
macropod macropod is offline need to find and create style Windows 10 need to find and create style Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For example:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "\<[! ]@\>"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  If .Find.Found = False Then
    MsgBox "No tags found", vbExclamation
  End If
  Do While .Find.Found = True
    .Style = Split(Split(.Text, "<")(1), ">")(0)
    .Text = vbNullString
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create text box in VBA and style content dpashley Word VBA 2 08-01-2017 01:40 AM
need to find and create style Modify or create a style otuatail Word 3 09-12-2016 12:20 PM
need to find and create style I create a new style but it fails to appear in Quick Style list veronius Word 6 06-18-2013 06:29 PM
need to find and create style How do I create a style that changes only the color??? wornways Word 1 12-21-2011 04:19 PM
need to find and create style Help to find Style Set Office Jazz43 Office 1 05-28-2011 02:39 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:33 PM.


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