Office Watch

Office 2013

Office Mobile / iPad

Office 2010

Office 2007

Office 2003

Office XP

Office for Mere Mortals



Buying Office

Office 365


Office News Wire

Join us!

Our Ebooks

Mobile | PDA



Command Finder

Microsoft Office Bookshop



How to get formatted text out of the Access database into a Word Bookmark

View this page on the new web site - click here

by Access Watch

Bookmark and Share

  | Mobile | click for more article services     

View this page on the new web site - click here

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
   DoCmd.RunCommand acCmdCopy
   appWord.Selection.PasteAndFormat (wdFormatPlainText)
   Exit Sub
   If Err = 429 Then
      'Word is not running; open Word with CreateObject
      Set appWord = CreateObject("Word.Application")
      Resume Next
      MsgBox "Error No: " & Err.Number & "; Description: " _
         & Err.Description
      Resume ErrorHandlerExit
   End If
End Sub

Article posted: Tuesday, 09 December 2008

View this page on the new web site - click here

there's more ...

If you liked this article you'll LOVE our new ebooks.

Office 2013: the real startup guide

OFFICE 2013: the real startup guide Everything you need to know about Office 2013 but Microsoft won't tell you.

How to save money, install, configure and use the new features in Office 2013.  Get it today - click here.

Windows 8 for Microsoft Office users

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.

Article Services sponsored by: Office Watch Ebooks - available now to download and read today.
RSS feed for this category Subscribe

Translate | Mobile | Links
 Add to: Bookmarks | | DiggThis | Yahoo! My Web

New & Popular
» New web site
» Two ways for sorting by Number
» Office for iPad, September updates
» Why is Gene Cernan ignored in Word?
» DropBox prices drop but is it enough?
» Sort by hidden column in Word

Office Watch, Office for Mere Mortals, Access Watch and all titles used within the publications are Copyright © 1996-2014 Office Watch.
Microsoft Office, Microsoft Word, Microsoft Excel, Microsoft Outlook, Microsoft Powerpoint and doubtless many other names are registered trademarks of Microsoft Corporation.

Search  |  Sitemap |  Popular Topics | Privacy Statement |  Advertising |  Twitter |  Feedback / Contact Us
Office Watch is definitely not affiliated with Microsoft - and that's just one reason why we are so useful to Microsoft Office users around the world J (Erko).