kenan
09-01-2014, 02:52 AM
hi everyone,
I am trying to convert content of word-file to html-file. The converting must be page by page with vba. for the converting is used following code.
*****************Beginn code: **********************
Dim wdNewDoc As Document
Dim appMsWord As Application
'tempFileName = ActiveDocument.Path & "\" & Left(ActiveDocument.Name, InStrRev(ActiveDocument.Name, ".") - 1) & ".HTM"
'TODO: benutzte dasselbe Dokument, falls das Dokument bereits existiert...
Set wdNewDoc = Documents.Add(Template:=ActiveDocument.AttachedTemplate.FullName)
With wdNewDoc
.ActiveWindow.WindowState = wdWindowStateMinimize
.Range(0, 0).Select
.content.FormattedText = objRange.FormattedText
.SaveAs tempFilename, wdFormatFilteredHTML
.Close
End With
************** end code ***************************************
The problem: it is very slow, if i am trying to convert page by page content of wordfile to html. for every page will be opened a new document window. I am trying to use the same document window, but i can not acces the html formatted file. Because the file is locked by ms office.
Do anybody know, how can I access read-only access a file, that already opened by ms office? or any better idea, how can I convert content of word file to html(it muste be page by page)
thanks!
I am trying to convert content of word-file to html-file. The converting must be page by page with vba. for the converting is used following code.
*****************Beginn code: **********************
Dim wdNewDoc As Document
Dim appMsWord As Application
'tempFileName = ActiveDocument.Path & "\" & Left(ActiveDocument.Name, InStrRev(ActiveDocument.Name, ".") - 1) & ".HTM"
'TODO: benutzte dasselbe Dokument, falls das Dokument bereits existiert...
Set wdNewDoc = Documents.Add(Template:=ActiveDocument.AttachedTemplate.FullName)
With wdNewDoc
.ActiveWindow.WindowState = wdWindowStateMinimize
.Range(0, 0).Select
.content.FormattedText = objRange.FormattedText
.SaveAs tempFilename, wdFormatFilteredHTML
.Close
End With
************** end code ***************************************
The problem: it is very slow, if i am trying to convert page by page content of wordfile to html. for every page will be opened a new document window. I am trying to use the same document window, but i can not acces the html formatted file. Because the file is locked by ms office.
Do anybody know, how can I access read-only access a file, that already opened by ms office? or any better idea, how can I convert content of word file to html(it muste be page by page)
thanks!