Re: Convert Word doc to HTML
- From: Chris Davoli <ChrisDavoli@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 1 Dec 2005 11:49:02 -0800
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
> >
>
>
.
- Follow-Ups:
- Re: Convert Word doc to HTML
- From: Chris Davoli
- Re: Convert Word doc to HTML
- References:
- Re: Convert Word doc to HTML
- From: Jonathan West
- Re: Convert Word doc to HTML
- Prev by Date: Re: Convert Word doc to HTML
- Next by Date: Re: Convert Word doc to HTML
- Previous by thread: Re: Convert Word doc to HTML
- Next by thread: Re: Convert Word doc to HTML
- Index(es):
Relevant Pages
|