I am exporting some query data to a word document using bookmarks. I can export text fields fine but rich text fields are problematic showing the HTML formatting when inserting into document. I need help with my existing code to convert this to text. The field in question is [CV_Intro]
Here is my code
Public Sub ExportCVToWord()
Dim wApp As Word.Application
Dim WDoc As Word.Document
Dim rs As DAO.Recordset
Dim rs2 As DAO.Recordset
Set wApp = Word.Application
Set WDoc = wApp.Documents.Open("S:\CV\CV -Blank.docx")
Set rs = CurrentDb.OpenRecordset("Qualifications_Selected_Individual_For_NEWCV")
Set rs2 = CurrentDb.OpenRecordset("NEWCV_Intro_Query")
If Not rs.EOF Then rs.MoveFirst
WDoc.Bookmarks("Name").Range.Text = Nz(rs!Name, "")
WDoc.Bookmarks("Qualifications").Range.Text = Nz(rs!Qualification, "")
rs.MoveNext
WDoc.Bookmarks("Qualifications2").Range.Text = Nz(rs!Qualification, "")
rs.MoveNext
WDoc.Bookmarks("Qualifications3").Range.Text = Nz(rs!Qualification, "")
If Not rs2.EOF Then rs.MoveFirst
WDoc.Bookmarks("CV_Intro").Range.Text = Nz(rs2!CV_Intro, "")
WDoc.SaveAs2 "C:\Users\Temp\Documents\CVs" & rs!Name & "-CV" & Format(Now(), "-dd-mm-yy") & ".Docx"
'Loop
WDoc.Close False
wApp.Quit
Set WDoc = Nothing
Set wApp = Nothing
Set rs = Nothing
End Sub
Here is my code
Public Sub ExportCVToWord()
Dim wApp As Word.Application
Dim WDoc As Word.Document
Dim rs As DAO.Recordset
Dim rs2 As DAO.Recordset
Set wApp = Word.Application
Set WDoc = wApp.Documents.Open("S:\CV\CV -Blank.docx")
Set rs = CurrentDb.OpenRecordset("Qualifications_Selected_Individual_For_NEWCV")
Set rs2 = CurrentDb.OpenRecordset("NEWCV_Intro_Query")
If Not rs.EOF Then rs.MoveFirst
WDoc.Bookmarks("Name").Range.Text = Nz(rs!Name, "")
WDoc.Bookmarks("Qualifications").Range.Text = Nz(rs!Qualification, "")
rs.MoveNext
WDoc.Bookmarks("Qualifications2").Range.Text = Nz(rs!Qualification, "")
rs.MoveNext
WDoc.Bookmarks("Qualifications3").Range.Text = Nz(rs!Qualification, "")
If Not rs2.EOF Then rs.MoveFirst
WDoc.Bookmarks("CV_Intro").Range.Text = Nz(rs2!CV_Intro, "")
WDoc.SaveAs2 "C:\Users\Temp\Documents\CVs" & rs!Name & "-CV" & Format(Now(), "-dd-mm-yy") & ".Docx"
'Loop
WDoc.Close False
wApp.Quit
Set WDoc = Nothing
Set wApp = Nothing
Set rs = Nothing
End Sub