PDA

View Full Version : Help writing code for macro used to paste text from internet



ecmike
01-28-2011, 09:05 AM
Hi there,

I am trying to write a macro in Word that will let me copy a text from the internet and do the following:

1) Paste selection as unformatted Unicode text formatting into Word
2) Remove all empty lines in selection
3) Change style of first line of selection to "Heading 2"
4) At beginning of third paragraph, hit backspace, pulling paragraph up behind second paragraph. Type "," and 1 space.
5) At end of first line, hit enter and type "Inserted by [Name]" in italics

Step 1) could be the last step as well if there is a way to do the formatting before pasting.

I have a basic understanding of VBA in Excel but am completely new to using it in Word and the Macro recorder isn't helping. Any help would be much appreciated. I imagine this shouldn't be too complicated to do?

Thanks.

fumei
01-28-2011, 01:28 PM
Why isn't the macro recorder not helping? Perhaps do some of the steps with the macro recorder.

There could be some issues. Often what looks like "empty lines" from a paste from the Web are manual line breaks, rather than paragraph marks. You may need to test for this.