Word VBA >> How to save formatted AutoText to a database

by Word Heretic » Thu, 29 Jul 2004 10:17:49 GMT

G'day Fry < XXXX@XXXXX.COM >,

Roll out changes as part of the networked SOE from the Helpdesk / IT
Providers. Keep them local on every workstation.


Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Fry reckoned:

>I would like to make a network database AutoText facility, i.e., the system in which selected Word objects (text, tables, etc.) will be saved in a database so that all the network users of the database could use it.
>
>The problem is how to save a Word object (with all formatting) to an external database? Internal Word AutoText preserves all formatting, but it is local, and I do not want to share normal.dot across the network.
>
>Any ideas?
>
>Fry



Similar Threads

1. DATABASE field table format - changes not saved over Citrix

2. Saving word documents to Oracle database with formatting

Hi! I am wandering if it's possible to save a portion of a Word 2000
document to an Oracle 8i database in such a way that the formatting of the 
text is not lost? I am going to retrieve the document from Oracle and redisplay 
with the original formatting. 

Please let me know.

Thank you in advance,

--Mike

3. Saving Formatted text to an Access Database

4. Saving Text formatting to Access Database

Hi...hopefully can help me with this.  I have written a front end to an
Access database and I want to make a modification.  I've changed the textbox
to a richtextbox so I can have formatting(bold, color, font, you know the
drill).  Anyway, I would like the formatted text to be saved to the
database....HOW??
When I send the text to the db, it writes out the formatting string and
hammers some of the real text.  Does anyone have a sample code of how to
save formatted text to an Access database.
Thanks a ton.
JD
 XXXX@XXXXX.COM 
 XXXX@XXXXX.COM 


5. Save 2007 Database in 2003 format with VBA - Microsoft Office Access

6. database saved as a document, somehow, must convert to database

Somehow I have saved the database I thought I was creating as a word doc. 
Initially I was trying to add to my existing datasource, but I don't know 
what happened from there. My main stress is that I really don't want to have 
to re-type all of these hundreds of clients' names and addresses again!! Is 
there anyone knows if you can transfer info to existing database/address 
list? Or even just converting the existing info into a new one would be just 
fine with me! I would much rather have to do a mail merge twice than re-type 
all of this stuff again. PLEASE HELP!

THANK YOU!!!
Tasha

7. Autotext in a database? - Word Document management

8. AutoText and Image question (Report for Database)

Let me explain what i'am doing.

I'd like to use Microsoft Word as a report generator for my database.
(I created a VB6 application that creates and has access to a Microsoft 
Access database )
One of my fields contains links to photos (full path). I want to print/save 
every record on a new page.
(One photo (with some text) per page in one single document)

I created a Ms Word template with bookmarks (within cells) for my fields and 
has access from my VB application to this document.
I create a new page for every new record from my database and use AutoText 
to create new Bookmarks.

First question:
If Ms Word is already active, the AutoText fails (Error numer 5825, The 
object is removed (translated from Dutch))
What can/must i do to prevent this ? (This error only occurs when Ms Word is 
already active)

Second question:
Is it possible to define the photo size in my template. (I has to resize the 
original photo to approximately 13 x 17 cm)
When the original photo is 2272x1704 everything goes well. The photo fills 
the cell. (about 13x17 cm)
But when the original photo is 800x600, it doesn't fill the cell)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Some code i'am using:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Dim WordObj As Word.Application
    Dim WordDoc As Word.Document
    Dim WordRange As Word.Range
    Set WordObj = CreateObject("Word.Application")
    Set WordDoc = WordObj.Documents.Add(App.Path & "\report.dot")
    WordObj.Visible = False

    ' The code below will place the text/photo in the bookmarked location
    'DESCRIPTION
    Set WordRange = WordDoc.GoTo(What:=wdGoToBookmark, Name:="description")
    WordRange.InsertAfter rs!description

    'PHOTO
    Set WordRange = WordDoc.GoTo(What:=wdGoToBookmark, Name:="photo")
    WordRange.InlineShapes.AddPicture Filename:=rs!filename, 
LinkToFile:=False, SaveWithDocument:=True

    ' The code below will go to end of page, create a pagebreak and insert 
the AutoText
    Selection.EndKey Unit:=wdStory
    Selection.InsertBreak Type:=wdPageBreak

    WordDoc.AttachedTemplate.AutoTextEntries("MyAutoText").Insert 
Where:=Selection.Range, RichText:=True


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Thanks in advance,

Robertico