Re: Convert Word doc to HTML

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks tried that but still get error. The error is on the line where I'm
instantiating word.
ie; a = New Word.Application

What else can I try to instantiate WORD?
--
Chris Davoli



"Jonathan West" wrote:

> 2 possible problems occur to me
>
> 1. You need to set a reference to Word object library in addition to the
> office object library
>
> 2. This line looks a bit odd.
>
> c.SaveAs(sf, Word.WdSaveFormat.wdFormatHTML) 'save the doc file as HTML
>
> Shouldn't it be this?
>
> c.SaveAs(sf, a.WdSaveFormat.wdFormatHTML) 'save the doc file as HTML
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>
> "Chris Davoli" <ChrisDavoli@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:882961CD-D0E3-4D24-BF56-BE7E5AA34B73@xxxxxxxxxxxxxxxx
> > I'm newbie trying to use Office Automation to change a WORD document to an
> > HTML document for later upload to a web site. When I try to instantiate
> > word
> > I get the error "Access is denied." What am I doing wrong?
> >
> > I added Microsoft.Office.Core to my references. I Think its an interop
> > component. Do I need to do something extra with interop compoonents?
> >
> > Any simple easy automation articles out there that converts WORD to HTML?
> >
> > Here is my code:
> > Dim a As Word.Application
> > Dim c As Word.Document
> > Dim sf, df As String
> > Try
> > 'Get valid file name
> > df = "c:\UploadTest\Herring Memo Holidays.doc"
> > sf = "c:\UploadTest\kk.html"
> > a = New Word.Application
> > c = a.Documents.Open(df)
> > c.Fields.Unlink()
> > c.SaveAs(sf, Word.WdSaveFormat.wdFormatHTML) 'save the doc file
> > as HTML
> > c.Close()
> > c = Nothing
> > a.Quit()
> > a = Nothing
> > 'MsgBox("Converted successfully")
> > Catch ex As Exception
> > Response.Write(ex.StackTrace)
> > 'MsgBox(ex.StackTrace)
> > End Try
> >
> >
> > --
> > Chris Davoli
> >
>
>
.



Relevant Pages

  • Re: FontBold Property
    ... You don't need to write the HTML yourself. ... Write and format your text in the Word document. ... objMAILITEM.Body = strBody ...
    (microsoft.public.access.modulesdaovba)
  • Re: How much should I charge for fixed-price software contract?
    ... we do NOT accept HTML ... Electronically, Word docs or PDF docs are accepted, ... I can, if I absolutely have to, create a Word document. ...
    (comp.programming)
  • Re: Canonical format for header files (was... who cares?)
    ... "We could convert the Word document to use a 'canonical form' of ... across the internet...then web browsers - able to read 'canonical ... It's not that "canonical form" has "more ... HTML", so to speak, then all the "endian" differences ...
    (alt.lang.asm)
  • Re: hide formatting text
    ... output from this app to generate it as a word document. ... if they have show/hide formatting text ... > the actual html when returning the web page to Word? ... > transport medium to return html created from Word docs back in to the ...
    (microsoft.public.word.docmanagement)
  • Re: Bizarre wildcard replace
    ... Had you thought of trying a tool named "Microsoft Word 2003"? ... It does a *perfect* job of converting a Word document to HTML. ...
    (microsoft.public.word.docmanagement)