'Make sure you release object references. ShtOut.Cells(lgOutputRow, 4).Value = lgPara ShtOut.Cells(lgOutputRow, 3).Value = lgLine (searching for a way for Find&Replace to add a Line-Break.) ps: on a Mac: find works with n and finds a New-Line character. ShtOut.Cells(lgOutputRow, 2).Value = lgPage
Set oWord = GetObject(, "Word.Application") Replace that parameter with wdActiveEndPageNumber.ĭim LastRow As Long ' last row with data in shtInĭim lgCurrRow As Long ' current row in shtInĭim lgOutputRow As Long ' current row in shtOut
If you've restarted the page numbers, the wdActiveEndAdjustedPageNumber parameter will cause the macro to get the modified number (i.e., what a field would show) if you want the absolute page number, If you only want to search for words in a specific section of text (rather than the whole document), highlight that section instead. 'Find and Replace' will only search for words after the cursor. Click to the left of the first word in your document to place the cursor there. "blank line") counts as both a line and a paragraph. Place your cursor at the beginning of the document. The line numbers it finds start at 1 at the top of each page in the Word document. Whereas, it’s slightly different in our case where we have two (special). e.g., if you’re wanting to replace lines containing the word books, you’d type. In the Find what: text box, type the search word, preceded and followed by. This macro should do what you need, with a few caveats: It assumes the list of words is in column A of the first sheet in the current workbook. Topics: Line Spacing in Word - Paragraph Spacing - Alignment in Word - Paragraph Alignment - Vertical Alignment Horizontal Alignment - Bullet Points, Numbered List, Multilevel List Word. Press Ctrl + F to open the Find and Replace dialog.
A quicker way to find the paragraph number is shown in.