Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel with Multiple Worksheet
Message
From
11/01/2006 08:52:43
 
 
To
10/01/2006 20:39:18
General information
Forum:
Visual FoxPro
Category:
Third party products
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01085026
Message ID:
01085586
Views:
35
Maybe try something more like:
oExcel = CreateObject("Excel.Application")
With oExcel
    .sheetsInNewWorkbook = 1
    .visible = .t.
    oWorkbook = .workbooks.add()
    oSheet = oWorkbook.sheets(1)
endwith
nrow=7
nrecno=1
Select cur_inv

with oSheet
    Go Top
    SCAN
        .Cells(nrow,1).Value=cur_inv.invdate
        .Cells(nrow,2).Value=cur_inv.icsno
        .Cells(nrow,3).Value=cur_inv.loctid
        nrow = nrow+1
        nrecno = nrecno+1
        IF nrecno=60 THEN
            nrow=7
            nrecno=1
&& I'm not sure what 'this' section is all about, but you have objects above for the excel application (oExcel) the workbook (oWorkbook) and the sheet (oSheet). From there you should be able to access all you need in Excel.
            with This   
                local loWorkbook
                loWorkbook = .oSheet.Parent
                .nActiveSheet = .nActiveSheet + 1
                if This.nActiveSheet > loWorkbook.Sheets.Count
                loWorkbook.Sheets.Add(NULL, loWorkbook.Sheets(loWorkbook.Sheets.Count))
                .oSheet = loWorkbook.ActiveSheet
                else
                .oSheet = loWorkbook.Sheets(This.nActiveSheet)
                endif
                .nRow = 1
                .nCol = 1
            endwith
        ENDIF
        SELECT cur_inv
    ENDSCAN
ENDWITH
Paul A. Busbey
Victoria Insurance
Previous
Reply
Map
View

Click here to load this message in the networking platform