This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Other Languages and the fly likes Microsoft Word Copy & Paste Macro Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "Microsoft Word Copy & Paste Macro" Watch "Microsoft Word Copy & Paste Macro" New topic

Microsoft Word Copy & Paste Macro

Tess Jacobs

Joined: Feb 07, 2012
Posts: 24
I have a microsoft word document. In my document, some paragraphs contain the string <@@>. I want to write a macro that will search my document for the string <@@>. When it finds a paragraph which contains this string, it should copy the paragraph and then paste as hyperlink at the top of the document. It should repeat this process until it cannot find the string <@@>.

I tried this code but I keep getting the error message

Run-time error '4605'
This method or property is not available because the Clipboard is empty or not valid.

The problem is this line

I don't get any error message when I replace it with this line, but I don't want an ordinary paste; I want to paste as hyperlink

What am I doing wrong?
I agree. Here's the link:
subject: Microsoft Word Copy & Paste Macro
Similar Threads
Writing RTF files from Java Swing DefaultStyledDocuments
raw xml as the payload
Calling Word macro from java getting read only popup
insert header and footer with POI HWPF?
Editing pdf/word content (text replacement)