Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel with Multiple Worksheet
Message
From
10/01/2006 20:14:29
 
 
To
10/01/2006 08:40:43
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
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:
01085472
Views:
26
>>>The following is from my class that manages Excel:
>>>
>>>
>>>* Method: NextSheet
>>>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
>>>
>>
>>Hi Hilmar,
>>
>> thanks for your quick reply, i tried to incorporate this code but "Unknown Member oSheet" displayed on my screen?
>>
>>thanks
>
>That is part of a larger class, and you have to adapt it.
>
>.oSheet is a property of the class, which already points to a spreadsheet - as a >result of previous Automation work. You can replace it with a variable, like >loSheet, which also points to a spreadsheet.


Hi Hilmar,


This is my code,

ole = CreateObject("Excel.Application")
With ole
nrow=7
nrecno=1
Select cur_inv
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

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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform