|
Q: Dawn Crosier writes: I read through your “Access 2007 VBA For Data-Centric Microsoft Office Applications” and have questions about how to get formatted text out of the Access database into a Word Bookmark without bringing all the HTML code.
A: I did some experimentation, using my Rich Text Demo sample database from Access Archon #157. I found that the plain text could be extracted from rich text in an Access control using the wdFormatPlainText named constant. Here is code for a command button Click event that puts the plain text from a Rich Text control into a new Word document (it could also be written to a bookmark or doc property): Private Sub cmdPastePlainTexttoWord_Click() On Error GoTo ErrorHandler Dim strRichText As String Dim appWord As Word.Application Dim doc As Word.Document Set appWord = GetObject(, "Word.Application") Set doc = appWord.Documents.Add Me![txtLetterBody].SetFocus DoCmd.RunCommand acCmdCopy doc.Select appWord.Selection.PasteAndFormat (wdFormatPlainText) ErrorHandlerExit: Exit Sub ErrorHandler: If Err = 429 Then Set appWord = CreateObject("Word.Application") Resume Next Else MsgBox "Error No: " & Err.Number & "; Description: " _ & Err.Description Resume ErrorHandlerExit End If End Sub
Article posted: Tuesday, 09 December 2008
there's more ...
If you liked this article you'll LOVE our new ebooks.
 |
Windows 8 for Microsoft Office users A practical guide the new, changed and unfamiliar in Windows 8
A focused and unvarnished look at Windows 8, especially written for
the many people who use Microsoft Office Get it today
- click here.
|
ORGANIZING OUTLOOK EMAIL - tame your Outlook 2010 Inbox
100+ pages of practical tips and help to streamline,
automate and search your Inbox. Get more
than you ever thought possible from Outlook. Read it today
- click here.
|