Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel error
Message
De
13/01/2014 17:20:10
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01591785
Message ID:
01591797
Vues:
35
Are you suggesting something like this:
for i = 1 to lnNumberOfFiles

   if mod(1,100) = 1
     FireUpExcel()
  endif

   loWorkbook = _screen.oStuff.oExcel.Workbooks.OPEN(tcFile, tlUpdateLinks)

   Code...
   Code...

   loWorkBook.CLOSE(tlSavetheFile)

next

return

function FireUpExcel()

if ExcelisActive()
  _screen.oStuff.oExcel.QUIT()
  _screen.oStuff.oExcel = NULL
endif

SET MESSAGE TO 'Activating Excel...'
_screen.oStuff.oExcel = CREATEOBJECT("Excel.application")
_screen.oStuff.oExcel.VISIBLE = .F.

return .t.
>You're saying it chokes after ~160 files, so to play if safe I'd say try 100 files at once.
>
>>Since I'm closing each file after I open it, what limit could that be?
>>
>>>How about you will do the process in a loop of ~ 100 files at once? Looks like you somehow are reaching the Excel limits, so it may help to close excel after each 100 files and repeat the process for reminder
>>>
>>>
>>>>Hi All:
>>>>
>>>>I have a loop that processes a number of Excel files in a folder. It extracts information from each file and then closes the file. Then it loops to the next one. After about 160 files, the system chokes and throws an 'exception'. When I loop to the next file, the same exception. Here are the details:
>>>>
>>>>
>>>>FUNCTION ExcelFileOpen(toExcel, tcFile, tlUpdateLinks, toStuff, tlProtection, tcPassword, taSheetVisible)
>>>>
>>>>LOCAL retparm, loWorkbook
>>>>
>>>>retparm = .T.
>>>>
>>>>TRY
>>>>
>>>>	loWorkbook = toExcel.Workbooks.OPEN(tcFile, tlUpdateLinks)
>>>>
>>>>CATCH TO ww
>>>>
>>>>	errortextbuild(toStuff, ;
>>>>		'Error in ' + JUSTSTEM(tcFile) + ': ' + 'File cannot be opened', .F., .T., .T.)
>>>>	retparm = .F.
>>>>	SUSPEND
>>>>
>>>>ENDTRY
>>>>
>>>>
>>>>Some values for the object 'ww' are:
>>>>
>>>>
>>>>baseclass  "Exception"
>>>>details       "80010105: The server threw an exception"
>>>>Errorno     1426
>>>>message   "OLE erroe code 0x80010105: The server threw an exception"
>>>>
>>>>
>>>>Any ideas?
>>>>
>>>>Thanks,
>>>>
>>>>Yossi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform