Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel won't paint correctly
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Excel won't paint correctly
Miscellaneous
Thread ID:
00716458
Message ID:
00716458
Views:
42
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
Next
Reply
Map
View

Click here to load this message in the networking platform