Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-10-2021, 06:06 PM
RavindraBanthia RavindraBanthia is offline Help in finding/developing a macro to markup and apply styles to a Word document Windows 10 Help in finding/developing a macro to markup and apply styles to a Word document Office 2007
Advanced Beginner
Help in finding/developing a macro to markup and apply styles to a Word document
 
Join Date: Jan 2019
Posts: 33
RavindraBanthia is on a distinguished road
Default Help in finding/developing a macro to markup and apply styles to a Word document

Hi,



I need help and or advice on a locating/developing a VB script for the following:

1) Marking up all words/phrases/sentences that have a particular format (italics, bold, etc.) with say user-defined delimiters such as “<” and “>”

2) Applying formatting (italics, bold, etc.) or user-created styles to all words/phrases/sentences that are delimited with user-defined delimiters such as “<” and “>”

I have browsed the excellent sites of both Gregory K. Maxey and Graham Mayor, but I was unable to apply those macros for the above purposes.

Thank you.
Reply With Quote
  #2  
Old 03-10-2021, 06:51 PM
macropod's Avatar
macropod macropod is offline Help in finding/developing a macro to markup and apply styles to a Word document Windows 10 Help in finding/developing a macro to markup and apply styles to a Word document Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

See, for example: https://www.msofficeforums.com/126958-post8.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 03-10-2021, 07:05 PM
RavindraBanthia RavindraBanthia is offline Help in finding/developing a macro to markup and apply styles to a Word document Windows 10 Help in finding/developing a macro to markup and apply styles to a Word document Office 2007
Advanced Beginner
Help in finding/developing a macro to markup and apply styles to a Word document
 
Join Date: Jan 2019
Posts: 33
RavindraBanthia is on a distinguished road
Default

Thank you, Macropod.

I am a newcomer to VBA, but the code seems to make sense.
Reply With Quote
  #4  
Old 03-11-2021, 03:11 PM
RavindraBanthia RavindraBanthia is offline Help in finding/developing a macro to markup and apply styles to a Word document Windows 10 Help in finding/developing a macro to markup and apply styles to a Word document Office 2007
Advanced Beginner
Help in finding/developing a macro to markup and apply styles to a Word document
 
Join Date: Jan 2019
Posts: 33
RavindraBanthia is on a distinguished road
Default

Hello Macropod,

The first routine works perfectly except when the paragraph mark itself is bold/italics.

So, I’d first need to clean up all para marks.

Also, if the space beyond the italicized element (word/phrase/sentence) is bold/italics, the space is included in the tag.

The second routine works like a charm and correctly formats the document based on the tags.

Thank you. That helps reduce a lot of the mundane Find/Replace/Insert work.

I wonder if the first routine can be easily modified to ignore formatted paragraph marks and formatted space that comes after the relevant formatted text.

Also, in both routines, it would be great if we could use a user-defined style for selection of text to be tagged and subsequently the tagged material to be formatted.

Even if the routines cannot be extended (easily), thank you indeed.

Ravi
Reply With Quote
  #5  
Old 03-11-2021, 04:05 PM
macropod's Avatar
macropod macropod is offline Help in finding/developing a macro to markup and apply styles to a Word document Windows 10 Help in finding/developing a macro to markup and apply styles to a Word document Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Quote:
Originally Posted by RavindraBanthia View Post
The first routine works perfectly except when the paragraph mark itself is bold/italics.
On the contrary, it handles those paragraph marks correctly, precisely because that is how they have been formatted. To exclude the paragraph marks, change:
.Text = ""
to:
.Text = "[!^13]{1,}"

See the notes in the linked post.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 03-11-2021, 04:43 PM
RavindraBanthia RavindraBanthia is offline Help in finding/developing a macro to markup and apply styles to a Word document Windows 10 Help in finding/developing a macro to markup and apply styles to a Word document Office 2007
Advanced Beginner
Help in finding/developing a macro to markup and apply styles to a Word document
 
Join Date: Jan 2019
Posts: 33
RavindraBanthia is on a distinguished road
Default

Thank you, Macropod.

I see this in the note:

As coded, that macro will also insert the </i>, etc. after any formatted paragraph mark. To exclude the paragraph marks, change:
.Text = ""
to:
.Text = "[!^13]{1,}"

Thank you for giving me a great starting point.

I’ll try to study VBA and extend the code a little.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to apply Normal dot styles John9210 Word VBA 2 06-07-2018 05:15 PM
URGENT: Macro to open document and apply other macros successively Krategy Word VBA 1 12-02-2016 04:41 PM
VBA Word - Find & Apply Styles to Specific Words - Using Case Statement jc491 Word VBA 17 12-26-2015 12:25 PM
Apply styles in word table 1van Word VBA 2 11-17-2015 11:05 AM
Help in finding/developing a macro to markup and apply styles to a Word document Need help developing a way to visually represent information on Word Liz T Word 4 07-22-2015 09:10 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:15 AM.


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