Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Hey, Scripting Guy! How Can I Search For a Specific Style in a Folder Full of Microsoft Word Documents?

(image) Hey, Scripting Guy! I have a folder with scores of Word documents in it. What I need to do is open each document, copy anything that uses the Heading 1 style, and then write that information (the file name and anything that uses the Heading 1 style) to a single text file. Is there a way to do this using a script?-- DN(image) (image...

Hey, Scripting Guy! How Can I Copy a Portion of a Microsoft Word Document to a New Microsoft Word Document?

(image) Hey, Scripting Guy! How can I find some text in a Microsoft Word document, copy the rest of the document from that point on, then paste the copied text into a brand-new Word file?-- CB(image) (image) (image) Hey, CB. You know, it’s kind of a melancholic day here at Scripting Guys world headquarters. That’s because the Juanita ...

Hey, Scripting Guy! How Can I Randomly Assign a Font to Characters in a Word Document?

(image) Hey, Scripting Guy! I’ve come up with a way to imitate handwriting in a document, but I need some help. Because real handwriting is characterized by variability, I had the idea of using four slightly-different fonts, taken from my actual handwriting, and then randomly assigning a font to each letter. I think that would imitate ...

Hey, Scripting Guy! How Can I Find a Word in a Document and Change the Background Color of the Paragraph Where That Word Appears?

(image) Hey, Scripting Guy! I have a bunch of reports and log files that are saved as Microsoft Word documents. I’d like to be able to search for a specific word in one of these documents (e.g., the word “Failed”) and then change the background color of any paragraph that the target word appears in. How can I do that?-- XD (...

Hey, Scripting Guy! How Can I Count the Number of Sentences and Paragraphs in an Office Word Document?

(image) Hey, Scripting Guy! I just read your article about getting Word documents statistics and would like to know if there is any way of getting the number of sentences and paragraphs per document.-- RLP(image) (image) (image) Hey, RLP. To be perfectly honest, now that the Super Bowl is over the Scripting Guy who writes this column is ...