![]() |
#1
|
|||
|
|||
![]()
we do a single drag/copy/paste text from a proprietary app's text window and paste into a blank word page. it can be from a dozen lines to a few hundred lines. when in Word, we see each line has a paragraph mark.
we need to search the whole block and whenever we see a set text sting (thankfully unique i.e "KKJJ ABC") we need to go to the end of that line and insert 8 carriage returns. do until end. end product is 8 blank lines after each incidence of the string. i have put in buckets of BS&T manipulating Excel code, but those few different concepts of Word VBA still escape me at the moment. we needed this yesterday, and i just can't get the search,move,do, repeat individual parts to work together. Any help, extremely thankful.. -- Scott Last edited by sbktex; 09-18-2014 at 10:57 AM. Reason: SOLVED |
#2
|
|||
|
|||
![]() Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim oPar As Paragraph For Each oPar In ActiveDocument.Paragraphs If InStr(oPar.Range.Text, "KKJJ ABC") > 0 Then oPar.Range.InsertAfter String(8, vbCr) Next oPar End Sub |
#3
|
||||
|
||||
![]()
Cross-posted and answered 3 weeks ago at: http://www.excelforum.com/word-progr...t-in-line.html
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
donaldadams1951 | Word VBA | 4 | 03-14-2014 11:24 AM |
![]() |
omahadivision | Excel Programming | 12 | 11-23-2013 12:10 PM |
![]() |
VBNation | Word VBA | 2 | 02-08-2013 07:14 AM |
Excel Fomula to search for a string and display value from different column | zeeshanbutt | Excel | 1 | 07-29-2012 12:48 AM |
![]() |
paulkaye | Word | 4 | 12-06-2011 11:05 PM |