C
Chris Davoli
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
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