制作ASP组件急救!!!!高分酬谢!
本人利用VBA来将数据库中的试题转换成WORD文档。于是编写了Activex DLL组件covertodoc.dll,其中主要的代码:
Dim mydoc As Word.Document
Dim r As Range
Set mydoc = CreateObject("word.document")
With mydoc ' ****** erro line******
.Paragraphs.Item(.Paragraphs.Count).Range.InsertParagraphAfter
Set r = .Paragraphs.Item(.Paragraphs.Count).Range
r.text = text
.Paragraphs.Item(.Paragraphs.Count).Range.InsertParagraphAfter
Set r = .Paragraphs.Item(.Paragraphs.Count).Range
r.InlineShapes.AddPicture (picfilename)
.SaveAs (docfilename)
.Close
End With
Set r = Nothing
Set mydoc = Nothing
该代码在EXE工程中调试完全正确,但移植成DLL调试出错:
错误类型:
Microsoft Word (0x800A16C1)
对象已被删除。
/tytk/build/makedoc.asp, 第 13 行
即注释 ' ****** erro line****** 的行中mydoc对象出错。
请高手们帮忙诊断!!