Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-08-2019, 10:16 AM
gmaxey gmaxey is offline Why does paragraph inherit style of the following paragraph? Windows 10 Why does paragraph inherit style of the following paragraph? Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

I'm guessing is it is because the search string includes the paragraph mark and with a replace, everything defined is replaced so in the resulting vacuum Word just thinks the style should be the one following. Something like this could be used as a work around:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
  Set oRng = ActiveDocument.Paragraphs(1).Range
  oRng.End = oRng.End - 1
  oRng.Text = Replace(oRng.Text, ",", " ", 1, , vbTextCompare)
lbl_Exit:
  Exit Sub
End Sub

__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply

Tags
inheritance, style



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inconsistent paragraph style electricaltill Word 10 01-06-2016 10:09 AM
Why does paragraph inherit style of the following paragraph? Removing a paragraph style from the TOC CTwriter Word 3 01-25-2013 12:38 AM
Paragraph Style for Thesis groxby Word 1 03-24-2012 04:45 AM
Why does paragraph inherit style of the following paragraph? Style seems to inherit bold setting from previous style Jennifer Murphy Word 3 02-16-2012 04:18 PM
Character style stripped while applying paragraph style sams_gates Word 0 08-29-2009 02:03 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:10 AM.


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