Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel with Multiple Worksheet
Message
From
10/01/2006 20:54:53
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
10/01/2006 20:44:40
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:
01085476
Views:
29
I didn't know you can insert directly into the Excel object; I thought you had to select a spreadsheet first.

Try to create a variable for the current spreadsheet, as in my article on Excel automation - http://www.utmag.com/wconnect/wc.dll?9,7,10,1562 . Then, from there, you can go "up" to the workbook, and select the next sheet, as in my example.

On the other hand, you might keep an object for the current workbook in the first place.

>Hi Hilmar,
>
> it gives me the same result," Unknown Member oSheet".
>
>
>        ole = CreateObject("Excel.Application")
>        With ole
>         nrow=7
>         nrecno=1
>           Select cur_inv
>            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
>
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform