0
votes

Ive got a word document with a lot of merge fields which look like this:

{ MERGEFIELD SOME_FIELD }

This works fine with unformatted text. But now I want to insert formated text this way. So the content of "SOME_FIELD" will be created out of Rich Text, including cursive and bold parts and newlines.

Is there a way to use merge fields where the formating comes out of the content of the related field. It does not have to be rich text.

All I found until now are solutions with automation. Like this: Word VBA macro to insert file and merge formatting But this does not word for me because in the moment I write the content of SOME_FIELD I don't have access to automation.

SME_FIELD is set with access vba like this (in the example the formating is set with rich text but I can use another formating language too):

dim richText as string
richText =  "Hey look, \b I'm bold \b0 and I'm not" 
with CurrentDb.OpenRecordset("Select SOME_FIELD from SOME_TABLE")
    Call .MoveFirst
    !SOME_FIELD = richText
    Call .Update
end with

I thought that there might be some other formating tags which word can read, but I did not find any.

1
How are you inserting the text? And, if it's not via a mailmerge, why are you using MERGEFIELDs?macropod
@macropod: The source data where the text is from the field "SOME_FIELD" in a table in a ms-access-database. I cant answer the why, because this is part of a legacy program which was not written by me.Gener4tor
This is not an appropriate question in Stack Overflow, despite the programming aspects of mail merge in Word. stackoverflow.com/help/on-topic It would be well-received in the SuperUser forum. superuser.com/questions/tagged/microsoft-word A mail merge does not bring in the formatting from the source. You can format the field, itself.Charles Kenyon
@CharlesKenyon «This is not an appropriate question in Stack Overflow, despite the programming aspects of mail merge in Word». That is plain nonsense. As the OP has clarified «this is part of a legacy program»!macropod
@Gener4tor In that case, we'd need to see the relevant parts of the code that updates the fields before any informed advice could be given. Please add that code to your original post. What you're trying to do - given the «cursive and bold parts and newlines» cannot be done via field coding.macropod

1 Answers

0
votes

It seems like its not possible to insert format information to word via a merge field.