Consulting

Results 1 to 4 of 4

Thread: A Scheme for Saving Marked-Up Text in Access and Importing as Formatted Text in Word

  1. #1
    VBAX Regular
    Joined
    Nov 2008
    Posts
    44
    Location

    A Scheme for Saving Marked-Up Text in Access and Importing as Formatted Text in Word

    Hi, all.

    I'm using an Access 2003 database to store some commonly re-used text chunks for our business. I developed a Word macro that lets the user browse the entries in the database and insert the desired one into their document. Some of these re-usable text chunks must have the capability of being imported into the Word document with italics. The Access 2003 Memo data type does not allow rich text, so I devised some custom markup tags to wrap around the portions of text I want ultimately to be italicized. These tags are stored in-line with the text in the Memo field in Access. In my Word macro, I insert the text into the Word document, search the inserted text for these markup tags, replace what's between the tags with formatted text, and then delete the tags. This seems lame to me, but I'm not sure of another way. Aside from being cumbersome, it kind of makes the stored text in the Memo field unweildy-looking for regular users who might be browsing the database directly. I might also need to pull these text chunks and use them somewhere else, and these custom markup tags will travel with the text and not mean anything unless I'm always implementing some sort of function described above.


    Is there a better way?


    Thanks,

    Duluter

  2. #2
    I don't have Office 2003 but couldn't you use AutoText instead? Just put these text chunks in a template file as AutoText entries and put a copy of that template in everyone's Word StartUp folder, or otherwise make it available to everyone.

    If you have to use Access, does it have an OLE data type?

  3. #3
    VBAX Regular
    Joined
    Nov 2008
    Posts
    44
    Location
    Nelviticus:

    Those are good suggestions. Unfortunately, I don't think AutoText entries will work for me. I'm attempting to create a central data repository that consists of commonly reused data. The repository needs to be accessible through the browser on the corporate intranet, and it needs to be accessible in flexible ways within Word. This seems to call for a centralized database, rather than a distributed Word template solution.

    Regarding Access's OLE data type, I'm not sure how I would be able to use it. Can this data type store discrete, formatted text chunks?


    Duluter

  4. #4
    This is what the Access 2007 help has to say about the OLE Object data type:

    'An object (such as a Microsoft Excel spreadsheet, a Microsoft Word document, graphics, sounds, or other binary data) linked (OLE/DDE link: A connection between an OLE object and its OLE server, or between a Dynamic Data Exchange (DDE) source document and a destination document.) to or embedded (embed: To insert a copy of an OLE object from another application. The source of the object, called the OLE server, can be any application that supports object linking and embedding. Changes to an embedded object are not reflected in the original object.) in a Microsoft Access table.'

    I knew that Access had an OLE data type but I've never used it and my Access skills were patchy before they became rusty so I can't help you with the specifics.

    However I've just run a test where I created a new DB and added a table with a single field of the OLE Object type, copied some formatted text from Word, pasted it into a new record, cleared the clipboard, copied the field and pasted it back into Word. It worked and the formatting was preserved. Hopefully you can use that somehow.

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •