|
-
Nov 13th, 2000, 01:12 PM
#1
Thread Starter
New Member
Seems simple enough...populate listbox w/ filenames, set new object to Word.Application, open file, save as RTF, save as HTML, close document, move to next.
The problem seems to be that each time it is sucking up a bit of memory it is not releasing and eventually it grinds to a halt when doing 2000 or so docs (121mb; makes it to around 1500 docs). Word 2000 being used.
Any ideas? Below is general code used:
Private Sub ConvertToRTFandHTM()
Dim wrdConverter As FileConverter
Dim wordAppRTF As Word.Application
Set wordAppRTF = New Word.Application
Dim bFoundConverter As Boolean
On Error Resume Next
wordAppRTF.Visible = False
If List1.ListCount > 0 Then
For n = 0 To (List1.ListCount - 1)
wordAppRTF.Documents.Open FileName:=List1.List(n)
wordAppRTF.DefaultSaveFormat = "Rtf"
wordAppRTF.ActiveDocument.SaveAs "TEMP.RTF", FileFormat:=wdFormatRTF
For Each wrdConverter In wordAppRTF.FileConverters
If wrdConverter.ClassName = "HTML" Then
bFoundConverter = True
Exit For
Else
bFoundConverter = False
End If
Next wrdConverter
If bFoundConverter = True Then
wordAppRTF.ActiveDocument.SaveAs FileName:="TEMP.HTM", FileFormat:=wrdConverter.SaveFormat
Else
wordAppRTF.ActiveDocument.SaveAs FileName:="TEMP.HTM", FileFormat:=wdFormatHTML
End If
wordAppRTF.ActiveDocument.Close
Set wrdConverter = Nothing
Set TempDir = Nothing
Set TempFile = Nothing
Next
End If
wordAppRTF.Quit
Set wordAppRTF = Nothing
On Error GoTo 0 'Turn off error handler
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|