Macro to copy text from bookmark with code to clipboard

G

gouved

Try as I can to use suggestions, examples , etc. I cannot debug a macro to
get text generated within a bookmark to copy to the clipboard.

I set up a bookmark (not formfield) to contain references from my document
to generate a note:
(name ref) is (age calculation) y.o. (sex ref) (if statements) ---etc.

I usually copy the note manually after unprotecting the document, then paste
it in an access application (on a network) so I wrote the following:

Dim P_Status
With ActiveDocument
P_Status = .ProtectionType
If .ProtectionType <> wdNoProtection Then .Unprotect
.Bookmarks("Note").Value.Copy
If P_Status > -1 Then .Protect Type:=P_Status, Noreset:=True
End With

The compiler has a problem with the copy command, stating it needs an
object. I just don't see the problem.

Thanks.
 
D

Doug Robbins - Word MVP

Use .Range instead of .Value

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top