为什么在asp代码中创建word对象会有问题
展开全部
代码
<%
Response.Write "<script language=vbscript>"& chr(13)
Response.Write "function InsertWord()" & chr(13)
Response.Write "on error resume next"& chr(13)
Response.Write "dim wordApp" & chr(13)
Response.Write "Set wordApp = CreateObject(""Word.Application"")" & chr(13)
Response.Write "if Err.Number<>0 then" & chr(13)
Response.Write " MsgBox ""本机没有安装Word2000,也可能生成新文件时出错!"", 16, ""输出到Word""" & chr(13)
Response.Write " set wordApp=nothing" & chr(13)
Response.Write " exit function" & chr(13)
Response.Write "end if" & chr(13)
Response.Write "WordApp.Visible = True" & chr(13)
Response.Write "WordApp.windowstate=1" & chr(13)
Response.Write "WordApp.Documents.Add " & chr(13)
Response.Write "WordApp.activewindow.View.ShowParagraphs=False" & chr(13)
Response.Write "wordApp.Selection.TypeText ""拟稿时间""" & chr(13)
Response.Write "wordApp.Selection.TypeText "" """ & chr(13)
Response.Write "wordApp.Selection.TypeText """ & ConvDateTime(rs1("DpcDate")) & """" & chr(13)
Response.Write "wordApp.Selection.TypeText "" """ & chr(13)
Response.Write "wordApp.Selection.TypeText ""拟稿人""" & chr(13)
Response.Write "wordApp.Selection.TypeText "" """ & chr(13)
Response.Write "wordApp.Selection.TypeText """ & strUserName & """" & chr(13)
Response.Write "wordApp.Selection.TypeParagraph" & chr(13)
%>
<%
Response.Write "<script language=vbscript>"& chr(13)
Response.Write "function InsertWord()" & chr(13)
Response.Write "on error resume next"& chr(13)
Response.Write "dim wordApp" & chr(13)
Response.Write "Set wordApp = CreateObject(""Word.Application"")" & chr(13)
Response.Write "if Err.Number<>0 then" & chr(13)
Response.Write " MsgBox ""本机没有安装Word2000,也可能生成新文件时出错!"", 16, ""输出到Word""" & chr(13)
Response.Write " set wordApp=nothing" & chr(13)
Response.Write " exit function" & chr(13)
Response.Write "end if" & chr(13)
Response.Write "WordApp.Visible = True" & chr(13)
Response.Write "WordApp.windowstate=1" & chr(13)
Response.Write "WordApp.Documents.Add " & chr(13)
Response.Write "WordApp.activewindow.View.ShowParagraphs=False" & chr(13)
Response.Write "wordApp.Selection.TypeText ""拟稿时间""" & chr(13)
Response.Write "wordApp.Selection.TypeText "" """ & chr(13)
Response.Write "wordApp.Selection.TypeText """ & ConvDateTime(rs1("DpcDate")) & """" & chr(13)
Response.Write "wordApp.Selection.TypeText "" """ & chr(13)
Response.Write "wordApp.Selection.TypeText ""拟稿人""" & chr(13)
Response.Write "wordApp.Selection.TypeText "" """ & chr(13)
Response.Write "wordApp.Selection.TypeText """ & strUserName & """" & chr(13)
Response.Write "wordApp.Selection.TypeParagraph" & chr(13)
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询