Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-17-2011, 11:20 AM
eosrose eosrose is offline Replacing horizontal lines Windows 7 64bit Replacing horizontal lines Office 2007
Novice
Replacing horizontal lines
 
Join Date: Dec 2011
Posts: 1
eosrose is on a distinguished road
Default Replacing horizontal lines


I've created some macros that will easily convert text that I've copied from my web browser and pasted into word into valid xhtml that I can then paste into Sigil and save as an epub. My issue is that sometimes the text pasted into Word has horizontal lines. How can I replace this lines with my usual code for dividers (an asterisk wrapped in paragraph tags)?
Reply With Quote
  #2  
Old 12-17-2011, 02:24 PM
macropod's Avatar
macropod macropod is offline Replacing horizontal lines Windows 7 64bit Replacing horizontal lines Office 2010 32bit
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

Hi eosrose,

That all depends on what kinds of horizontal lines you're dealing with; they could be underlines, paragraph borders or graphical objects, and each kind requires a differrent treatment.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 06-16-2023, 11:58 PM
piecevcake piecevcake is offline Replacing horizontal lines Windows 8 Replacing horizontal lines Office 2007
Novice
 
Join Date: Oct 2017
Posts: 3
piecevcake is on a distinguished road
Default

Gee thanks Macropod. Your non-answer turns up at the top of google search, marked "solved".



Here's a sample, for inserted lines.



Sub R___Lines_ReplaceAllWithString_wdInLineShapeHorizo ntalLine_ForEachLoop()
' deletes lines inserted by borders>horizontal line
'1.===== Name pre-selected range (if LOOP is going to be executed or called on a TABLE) R___PRESELECTED_RANGE_SetAndRESELECTafterLOOPS Macro
Dim PRESELECTED_RANGE As Range

'1a.________ if no selection, msgbox select all, dont select or exit
If Selection.Range = "" Then
SELECT_RANGE = MsgBox("Select whole document?" & vbNewLine & _
"Cancel to make selection manually!" & vbNewLine & _
"No will run only on the selection type the cursor is in.", _
vbYesNoCancel + vbDefaultButton2)
If SELECT_RANGE = vbYes Then
Selection.WholeStory 'selects whole document - then save selection below
ElseIf SELECT_RANGE = vbCancel Then
Exit Sub
End If 'SELECT_RANGE options (will continue with no selection made if yes or cancel not pressed)
End If

'1b.________ set preselected range
Set PRESELECTED_RANGE = Selection.Range 'needs to be set after every preselected range dim, and after every loop

'2.====== CODE range.[QUALIFIER] - loop actions on range here - eg:

Dim INLINE_SHAPE As InlineShape
For Each INLINE_SHAPE In PRESELECTED_RANGE.InlineShapes 'range MUST specify object types
' For Each INLINE_SHAPE In Selection.InlineShapes
With INLINE_SHAPE
If INLINE_SHAPE.Type = wdInlineShapeHorizontalLine Then
INLINE_SHAPE.Select
' If MsgBox("Horiz line, replace?", vbYesNoCancel + vbDefaultButton2) = vbYes Then
' INLINE_SHAPE.Delete
Selection.TypeText Text:="|L|"
' End If
End If
End With
Next

'3.====== reselect range for exit or next action (in MAIN macro, before LOOP macros called, +after each "next" command)
'!!!!!!!!!!!! repeat in called macros
PRESELECTED_RANGE.Select 'add after every "next" - for exit or next procedure

End Sub
Reply With Quote
Reply

Tags
find/replace, horizontal lines, macros

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing horizontal lines Word replacing problem!!!! Jamal NUMAN Word 2 07-08-2011 03:56 AM
Replacing horizontal lines fine horizontal lines in photos dkitain Drawing and Graphics 2 06-07-2011 09:49 AM
Replacing horizontal lines Replacing default fonts mark98101 Word 1 01-31-2011 02:31 PM
Replacing horizontal lines Horizontal lines won't insert into full margins set in a doc. rec Outlook 2 06-14-2010 09:47 AM
Replacing / editting text LisaC Word 0 02-25-2010 03:40 AM

Other Forums: Access Forums

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