Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OLE Error with Excel opening a DBF file
Message
De
13/06/2017 14:16:55
 
 
À
13/06/2017 09:47:58
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows Server 2012 R2
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01651937
Message ID:
01651973
Vues:
57
>>>>An app has a function to save VFP data as a .XLSX file. The code below is 100% reliable on machines running Excel 2007 on Windows 7. On some machines with Windows 10 and Excel 2016, it fails when a call is made for Excel to open the FOX2X file.
>>>>
>>>>Does anyone have any ideas why Excel 2016 and/or Win10 might not like this code?
>>>>
>>>>
>>>>* Get Excel application object:
>>>>m.loExcel = CREATEOBJECT( "Excel.Application" )
>>>>
>>>>* Data munging to create a VFP cursor happens here
>>>>
>>>>* Save the cursor to a FOX2X file that can be opened by Excel:
>>>>m.lcDBF2X = ADDBS( SYS( 2023 ) ) + SYS( 2015 ) + ".DBF"
>>>>
>>>>COPY ALL TO ( m.lcDBF2X ) TYPE FOX2X
>>>>
>>>>* The following DOEVENTS call "fixed" OLE errors long ago with Win7/Excel 2007:
>>>>DOEVENTS FORCE
>>>>
>>>>* Open the FOX2X DBF in Excel, save to .XLSX format:
>>>>m.loExcel.DisplayAlerts = .F.
>>>>
>>>>* The next line is the one that throws errors:
>>>>m.loWorkbook = m.loExcel.Application.Workbooks.Open( m.lcDBF2X )
>>>>
>>>
>>>type fox2x creates a foxpro 2.x compatible file, not an excel file. Instead use VFPOLEDB. Check message #1650041
>>
>>Yes, I understand that. As noted in my comments, historically Excel has been able to open FOX2X files as "dBASE"/.DBF. They can then be saved as .XLSX files. I'd like to find out why this process is unreliable on Win10 and newer versions of Excel.
>
>It now too would open using jet or ace engine driver. The error code you get indicates that it is a security issue (access denied code).

On further testing, we have a machine where there are a total of 135 rows that may be exported to Excel.

If the user filters the rows so only 2 are selected, those work as expected, without error.

If all 135 rows are selected, the error occurs.

We have one debug build that writes out copies of the FOX2X DBF files that Excel tries to open. I'm getting the tester to send me those 2 files (2-row case and 135-row case). Maybe there's something strange in the latter.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform