How to remove certain rogue blank paragraphs

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
songdg
Posts: 575
Joined: 04 Oct 2017, 20:04

How to remove certain rogue blank paragraphs

28 Mar 2024, 21:44

How to remove certain rogue blank paragraphs, I want to remove rogue blank paragraphs from 3 to 8, but keep 1 and 2, that's the rogue blank paragraphs with no text in between.The code written by flyingDman would remove all of them.

Code: Select all

oWord := ComObjActive("Word.Application")
oWord.selection.wholestory
loop oWord.ActiveDocument.Paragraphs.count
	(strlen(oWord.selection.paragraphs.item(a_index).range.text) = 1) && lst .= a_index ","		

if lst ?? ""
	for x,y in strsplit(sort(trim(lst,","),"NRD,"),",")
		oWord.selection.paragraphs.item(y).range.delete()
Attachments
blank.rar
word document
(13.66 KiB) Downloaded 6 times
blandparagraphs.png
blandparagraphs.png (19.44 KiB) Viewed 73 times

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Bing [Bot], hiahkforum, w_i_k_i_d and 37 guests