Can't save Word Document in HTML format 
Author Message
 Can't save Word Document in HTML format

Good morning, all.

I have written a VBScript to save an uploaded document as HTML for our
Intranet.  The code works fine; the file is found, saved with the .htm
extension, and then displayed.  The only problem is that all
formatting is lost, such as font sizes and bolding!

I have looked in the object browser in Word to see what the value is
for SaveAs HTML and I have recorded a macro to get the value.  When I
record a macro, I am given the constant 100, but all the posts I read
say that the value is 8.  Well I have tried both of these and all I
get when the file is saved is the text, all the same size, with no
formatting.  This makes me think that I am not really getting an HTML
format, just a document saved with the .htm extension, if you know
what I mean.

I am running Office 97 on a WinNT 4 server.

Has anyone else had this problem?  Any ideas, war stories, references
or resources would be appreciated.


Sat, 03 Apr 2004 20:21:18 GMT  
 Can't save Word Document in HTML format
For archive purposes, here is the answer.  

This is the code that must be used.

You CANNOT refer to Fileconverters("HTML") due to a documented bug in WD97:


        'Get the file converter'
        'This is necessary due to a bug in Word 97.'
        '  See KB article ID: Q162132'
        for x = 1 to objApp.fileconverters.count
        if objApp.fileconverters(x).ClassName="HTML" then
        end if

        objApp.ActiveDocument.SaveAs "c:\temp\" & newFileName, fc        


Sun, 04 Apr 2004 03:00:52 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Read HTML formatted data from database field, Insert Wordmerge fields, and save as Word document

2. saving Word 2000 document as Word 97 format

3. Saving Word Documents

4. convert web form to MS word document and save to database

5. Cutting a full Word document and pasting it in another Word Document

6. How to save a word document using VBScript?

7. Saving a Word document

8. Remove Save Preview Picture Option in Word Documents

9. Help: saving a document in word

10. Cannot close Word document without saving

11. Retaining HTML formatting when inserting into a word document

12. Avoid user interaction when saving Word document as html


Powered by phpBB® Forum Software