title: word/VBA: Unable to retrieve formatted text from table
body: <p>I am using below code to generate XML from tables of word file. </p>
  
  <p><code>
  Sub exprt()
  Dim nofT, cnt, tag, btxt As Integer<br>
  Dim Rcnt As Long<br>
  Dim tit, pTyp, cValu As String<br>
  Dim dum  As Range<br>
  Set a = ActiveDocument.Tables<br>
  nofT = ActiveDocument.Tables.Count<br>
  Set docold = ActiveDocument<br></p>
  
  <p>For cnt = 5 To nofT<br>
  Selection.TypeText ("")<br>
  Selection.TypeParagraph<br>
  Selection.TypeText ("")<br>
  Selection.TypeParagraph<br>
  Set dum = ActiveDocument.Tables(cnt).Cell(2, 1).Range<br>
  dum.End = dum.End - 1<br>
  tit = dum.Text<br>
  tit = LTrim(Right(tit, (Len(tit) - InStr(tit, ":"))))<br>
  Selection.TypeText (Chr(9) + "&lt;" + Chr(33) + "[CDATA[" + tit + "]]>&lt;" + Chr(47) + "title_text_1>")<br>
  Selection.TypeParagraph<br>
  Selection.TypeParagraph<br>
  Rcnt = a(cnt).Rows.Count<br>
  Set dum = ActiveDocument.Tables(cnt).Cell(3, 1).Range<br>
  dum.End = dum.End - 1<br>
  pTyp = dum.Text<br>
  pTyp = LTrim(Right(pTyp, (Len(pTyp) - InStr(pTyp, ":"))))<br>
  tag = 1<br>
  For btxt = 6 To Rcnt - 1<br>
  Set dum = ActiveDocument.Tables(cnt).Cell(btxt, 1).Range.FormattedText<br>
  dum.End = dum.End - 1<br>
  Selection.TypeText (Chr(9) + "&lt;" + Chr(33) + "[CDATA[" + dum + "]]>&lt;" + Chr(47) + "body_text_" + LTrim(Str(tag)) + ">")<br>
  Selection.TypeParagraph<br>
  Selection.TypeParagraph<br>
  tag = tag + 1<br>
  Next<br>
  Set dum = docold.Tables(cnt).Cell(Rcnt, 1).Range<br>
  dum.End = dum.End - 1<br>
  Selection.TypeText (Chr(9) + "&lt;" + Chr(33) + "[CDATA[" + dum + "]]>&lt;" + Chr(47) + "prompt_text_1>")<br>
  Selection.TypeParagraph<br>
  Selection.TypeParagraph<br>
  Selection.TypeText ("&lt;" + Chr(47) + "data>")<br>
  Selection.TypeParagraph<br>
  Selection.Extend<br>
  Selection.HomeKey Unit:=wdStory<br>
  newTxt = ActiveDocument.ActiveWindow.Selection<br>
  Selection.Cut<br>
  Set dum = docold.Tables(cnt).Cell(1, 1).Range<br>
  dum.End = dum.End - 1<br>
  Call pub(dum.Text)<br>
  Next<br>
  End Sub<br>
  </code><br>
  <br> </p>
  
  <p><code>
  Sub pub(nme As String)<br>
  Dim FolderPath As String<br>
  Dim FileName As String<br>
  FolderPath = "c:/Chandru/"<br>
  FileName = nme &amp; ".xml"<br>
  Documents.Add<br>
  Selection.Paste<br>
  Call bld<br>
  ActiveDocument.SaveAs FileName:=FolderPath &amp; FileName, FileFormat:=wdFormatText<br>
  ActiveDocument.Close<br>
  End Sub
  </code></p>
  
  <p>Problem: I want to add "&lt; b> &amp; &lt; /b >" for bold text, similarly for italic text. When i retrieve the table cell content, i am not getting formatted text. How do i can add &lt; b> &amp; &lt; i> for bold &amp; italic text respectively??</p>