Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 在运行IIS8.5的Windows2012服务器上用经典ASP保存XLS工作表-部分有效_Excel_Com_Asp Classic_Save_Dcom - Fatal编程技术网

Excel 在运行IIS8.5的Windows2012服务器上用经典ASP保存XLS工作表-部分有效

Excel 在运行IIS8.5的Windows2012服务器上用经典ASP保存XLS工作表-部分有效,excel,com,asp-classic,save,dcom,Excel,Com,Asp Classic,Save,Dcom,因此,我们的一位程序员离开了巢穴,我们转向了Win2012解决方案。该网站运行良好,除了excel,其他一切都很好,特别是只有一行代码失败 我们正在IIS中为网站运行ASP classic,Excel对象创建得很好,图表保存在正确的文件夹中,但当它点击时: wb.SaveAs“D:\WEBSITES\test.xls” 该页面以500错误结束,然后将excel留在任务管理器的内存中。 如果我删除XLS上的保存,JPG将从图表中很好地保存,代码将继续并正确关闭excel。由于2003年服务器和20

因此,我们的一位程序员离开了巢穴,我们转向了Win2012解决方案。该网站运行良好,除了excel,其他一切都很好,特别是只有一行代码失败

我们正在IIS中为网站运行ASP classic,Excel对象创建得很好,图表保存在正确的文件夹中,但当它点击时:

wb.SaveAs“D:\WEBSITES\test.xls”

该页面以500错误结束,然后将excel留在任务管理器的内存中。 如果我删除XLS上的保存,JPG将从图表中很好地保存,代码将继续并正确关闭excel。由于2003年服务器和2012年服务器之间的代码没有改变,我有点困惑为什么它现在决定失败

我不知道该怎么做,当我这么做的时候,它通常是用来解决COM问题的,因为它在运行,这只是一个主要的p.I.t.a.这一点不起作用。提前感谢!:)

在Win2012、IIS 8.5上找到了:(其他人对堆栈溢出的修复-这也适用于Office 2000)

终于修好了。这就是有效的方法,以防将来有人会犯同样的错误

我们添加了两个文件夹:

C:\Windows\System32\config\systemprofile\Desktop
C:\Windows\SysWOW64\config\systemprofile\Desktop

您不应该在服务器上下文中使用Excel…但是,人们无论如何都会这样做。你能把代码放在VBS文件中,在服务器上以交互方式运行并成功吗?进程是否有权访问输出目录?您应该尝试捕获SaveAs返回的错误。你还没有告诉我们这是什么。
<%


    Dim xlapp   ' Our Excel App
    Dim wb      ' Our Workbook within the Excel App
    Dim ws      ' Our Worksheet within the Workbook 
    Dim crt     ' The chart object
    Dim SourceRange ' The Source Range for the chart object

    Const xlWorkSheet = -4167 
    Const xlLineMarkers = 65

    Set xlapp = CreateObject("Excel.Application")

    Set wb = xlapp.Workbooks.Add(xlWorksheet)
    Set ws = wb.Worksheets(1)


    xlapp.DisplayAlerts = false


    Set SourceRange = ws.Range("A3:B6")
    Set crt = ws.ChartObjects.Add(0, 0, 480, 383)
    crt.Chart.ChartWizard SourceRange, 3, , 2, 1, 0, 2, "Virgin Chaser Report " & formatdatetime(now(),2)
    crt.Chart.ChartType = 51


    crt.Chart.HasTitle = True
    crt.Chart.ChartTitle.Text = "Virgin Chaser Report " & formatdatetime(now(),2)
    crt.Chart.ChartTitle.AutoScaleFont = false
    crt.Chart.ChartTitle.font.Name = "Arial"
    crt.Chart.ChartTitle.font.Size = 12
    crt.Chart.ChartTitle.font.Strikethrough = False
    crt.Chart.ChartTitle.font.Superscript = False
    crt.Chart.ChartTitle.font.Subscript = False
    crt.Chart.ChartTitle.font.OutlineFont = False
    crt.Chart.ChartTitle.font.Shadow = False    

    crt.Chart.Export "D:\WEBSITES\test.jpg"
    wb.SaveAs "D:\WEBSITES\test.xls"


    wb.Saved = True
    Set crt = Nothing
    Set wb = Nothing
    xlapp.Quit
    Set xlapp = Nothing


response.end()

%>