Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel won't paint correctly
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Excel won't paint correctly
Divers
Thread ID:
00716458
Message ID:
00716458
Vues:
44
I've got the code below, which builds an XLS file (VFP6, Excel 2000, NT4). If I go to Windows Explorer and double click the filename Excel launches but the cells portion of the window never ever paints. If I tab I see the cell values in the formula bar. If I start Excel and use the File/Open dialog and pick the file the cells paint correctly. This code does work fine in VFP7, ExcelXP, XPPro but that doesn't help the production environment where this code really has to run,

What on earth have I done wrong?
local loExcel, loWorkbooks, loRow

loExcel = createobject( "excel.application" )
loExcel.Visible = .t.
loExcel.SheetsInNewWorkbook = 1

loWorkbooks = loExcel.Workbooks
loWorkbooks.Add()

local lnCols, lcFields, i

loRow = loExcel.ActiveSheet.Rows( 1 )

lcFields = "Salute,Firstname,Lastname,Title,Company,Address1,Address2,City,State," + ;
   "Zipcode,Country,Phone,Fax,Email"

lnCols = alines( laFields, chrtran( lcFields, ',', chr(13) ) )

for i = 1 to lnCols
   loRow.Columns( i ).Value = laFields[i]
endfor

create cursor exportquestions ( questionno i )
insert into exportquestions values ( 23 )
insert into exportquestions values ( 45 )
insert into exportquestions values ( 67 )

scan
   loRow.Columns( lnCols + recno() ).Value = "Q" + transform( exportquestions.questionno )
endscan

use in "exportquestions"

loRow = .null.

loExcel.ActiveWorkbook.Close( .t., "c:\temp\test" )

loWorkbooks = .null.

loExcel.Quit()

loExcel = .null.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform