Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error opening Excel file
Message
De
01/01/2012 08:29:49
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
15/12/2011 18:39:03
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
01531156
Message ID:
01531998
Vues:
43
>>Hi,
>>
>>An automation process that used to work is now failing, in Excel 2010, for security reasons. Apparently Excel finds the idea of being automated to open an Excel file suspicious.
>>
>>The relevant commands are:
>>
>>
>>copy to (lcTempFile) type XLS
>>...
>>loWorkbookTemp = This.oExcel.oApp.Workbooks.Open(lcTempFile)
>>
>>
>>Excel - if it was previously open - says something about the trust center (similar to the message below, shown in Visual FoxPro).
>>
>>After accepting the message in Excel, Visual FoxPro gives the error message "You are attempting to open a file type that is blocked by your File Block settings in the Trust center..."
>>
>>I have used COPY TO ... TYPE XLS to make an Excel automation faster - transfer an entire DBF at once - since transferring one cell at a time would be exceedingly slow, especially for large files.
>>
>>Any ideas, how best to handle this?
>
>I believe in Excel, if VBA/Macro security is set too high, automation won't work. I think by default it's fairly strict. You can set lower values by enabling the Developer tab ( http://www.peppercrew.nl/index.php/2010/06/enable-vbamarcos-in-excel-2010/ ), then going into "Macro Security" and experimenting with the options.

Thanks. We managed to allow configure Excel so that it allows opening the files through automation - but this is not an ideal solution, since it requires configuring Excel at every client site. Also, I prefer to keep the security options, since they are pressumably there for a reason.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform