Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel with Multiple Worksheet
Message
De
10/01/2006 20:44:40
 
 
À
10/01/2006 20:39:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01085026
Message ID:
01085475
Vues:
32
>>Does it work now?
>>
>>Three comments:
>>
>>1. You don't need GO TOP before a SCAN.
>>
>>2. It helps if you put computer code (in the UT) between the codes < pre > and < /pre > (without the spaces). In this case, spaces are maintained; the result is more readable.
>>
>>3. If you transfer lots of data, it is very slow to insert each cell individually. In this case, you might use copy & paste, or copy to DBF or to text delimited or something, and insert lots of records into Excel with a single command. Of course, also using Automation.
>>
>>>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
>

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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform