PDA

View Full Version : Overwriting bookmarks and crossreferences



Saabeirik
03-11-2013, 12:37 AM
Hi!

I have a Word userform, that I use to populate a form document with a lot of repeating data.


The thing is that from time to time it would be nice if i could remove all "automatics" like bookmarks and crossreferences and replace these with the actual content, before sending the document to others.


Example:

If I have this sentence [bookmark] |crossref|:

" We hereby confirm that [Carl Johnsen] has been working in our company. |Carl Johnsen| have never been late to work, and has done a very good job."



Is there a way I can have a button in my userform that replaces [Carl Johnsen] with just "Carl Johnsen", and the same with the crossreferences?


I've been looking for this for some time now, and I can't find the answer. I found someone with the same answer, but there was no answer. I'm an amateur with VBA, but at least I've managed to put together something that fit's my purpose. All I'm missing is this function.

Thanks in advance for any help!

macropod
03-11-2013, 01:32 AM
Using 'ActiveDocument.Fields.Unlink' will convert all fields (including XRefs) to plain text.

Saabeirik
03-11-2013, 02:22 AM
Thank you!

I'll look into this. In the meantime, I found (by som intense googling) that ctrl+shift+F9 unlinks all Xrefs. At least it's better than nothing :)

Doug Robbins
03-11-2013, 06:32 AM
You should consider have the code in your userform set the value of variables in the document and use DOCVARIABLE fields in the document whereever you want the data entered into the userform to appear.