Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel won't paint correctly
Message
De
29/10/2002 12:29:20
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00716458
Message ID:
00716504
Vues:
20
>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.
>
David,
loRow = loExcel.ActiveSheet.Rows( 1 )
would be :
loRow = loExcel.ActiveWorkBook.ActiveSheet.Rows( 1 )

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform