将应用程序数据导出为ex​​cel适用于某些用户,但不适用于其他用户

我有一个遗留应用程序(delphi5),允许用户导出数据到Excel。 据我所知,这个应用程序适用于Office 2013之前的所有用户。我们最近开始推出Office 365/2013 – 得到O365后,一些用户不再能够将数据导出到Excel。 就像我们可以告诉的那样,对于这些用户而言,没有任何事情发生(Excel没有获得焦点,没有新的工作表/选项卡被添加到现有的实例,如果没有运行,Excel不会启动)。 其他使用O365的用户似乎对应用程序没有任何问题。

几个月前,我们有一个用户遇到这个问题后,收到Office 2013(非O365)。 在任何编码/重大研究发生之前,用户被给了一个不同的硬盘驱动器(我想这是她以前的硬盘驱动器,但不是100%肯定),瞧,一切都为她工作。 这使我相信这可能是一个registry设置或其他configuration问题。

有没有人知道任何可能导致/解决这个问题的registry设置/应用程序configuration设置,我们是否必须重新编写导出数据的逻辑,还是有其他的东西我没有想到?

作为参考,这里是执行导出到Excel的代码片段(我添加了“ExcelApplication1.Connect;”如下所示http://www.djpate.freeserve.co.uk/AutoExcl.htm#StartingExcel – 但是,没有解决问题):

interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, StdCtrls,// excel_tlb, Forms, Dialogs, checklst, Buttons, ToolWin, ComCtrls, Menus, Grids, DBGrids, ExtCtrls, Db, DBTables, DBClient, About, Report, IniFiles, Cdberr32, Ulogin32, ComObj, olectnrs, Find, ImgList, excel97, OleServer, clipbrd, AppEvnts; . . . procedure TfrmMain.btnExportClick(Sender: TObject); var RangeE :Excel97.range ; I, Row : integer ; myClip : TClipBoard ; Arr : variant ; j : integer ; begin //Replacing zoli code with OLE server code GM //Create and show Excel spread sheet if qrylocations.RecordCount = 0 then Exit; try //Replace the after scroll procedure slows down process. qrylocations.AfterScroll := DummyMethod ; //Open Excel App and create new worksheet ExcelApplication1.Connect; ExcelApplication1.Visible[0] := True ; ExcelApplication1.Workbooks.Add(Null, 0) ; Arr := VarArrayCreate([1,qryLocations.Recordcount,1,3],varvariant) ; //Set teh data to the variant array with qryLocations do begin First; DisableControls ; for i := 0 to recordcount -1 do begin Arr[i+1,1] := Fields[0].ASstring ; Arr[i+1,2] := Fields[2].ASstring ; Arr[i+1,3] := Fields[5].ASstring ; Next ; end ; end ; //Set the excel worksheet to the variant array ExcelApplication1.Range['A1', 'C' + IntToStr(qrylocations.recordcount)].value := Arr ; finally qryLocations.EnableControls; //Reset the after scroll method back to original state qrylocations.AfterScroll := qryLocationsAfterScroll ; end ; end; 

ExcelApplication1的属性如下所示:

  • AutoConnect = false
  • AutoQuit = false
  • ConnectKind = ckRunningOrNew
  • 名称= ExcelApplication1
  • RemoteMachineName = [EMPTY]
  • 标记= 0

我怀疑问题是Office的新版本在“虚拟沙盒”中运行,这种伪虚拟机无法“看见”您计算机上安装的所有内容,传统的从非Office应用程序自动运行Office的方法不再有效,因为您的应用程序无法“看见”Office安装。

看看是否可以自动运行点击运行的应用程序? 更多细节。