quotation marks in word field text set from VB.NET app

  • Thread starter Vladimir Kryachko
  • Start date
V

Vladimir Kryachko

Hello,

I need to output a text in a Word document field. The document created from
a template and filled in my VB.NET application. All works well unless the
text contains a quotation mark ("), which delimits the text to output.
If I insert a backslash character immediately before the quotation marks,
this avoids from delimiting the text, but the inserted backslash characters
are displayed in MS Word document too.

I have the following VB.NET code for this:

doc.Fields.Add(doc.Range(0, 0), 6, str)

and, for instance, str is value "FirstName "Alex\"ander""

In this case the field will be set to Alex\"ander.

How can I output quotation marks in a field?

Thanks
 
C

Chad DeMeyer

Vladimir,

You might try

str = "FirstName ""Alex""ander""

VB/VBA interpret the two consecutive quotation marks as one quotation mark
within the string.

Regards,
Chad
 

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