Date: Thu, 8 Jul 1999 14:49:46 -0500
Reply-To: "James B. Luther, Ph.D." <jluther@POP.NLCI.COM>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "James B. Luther, Ph.D." <jluther@POP.NLCI.COM>
Subject: Re: script to send output to a specific cell within an excel
worksheet
Content-Type: text/plain; charset="iso-8859-1"
You can set individual cells or ranges in Excel using the worksheet object.
For example, the following snipit takes values from the data cells in a SPSS
Pivot Table and puts them into cells in the Active worksheet in Excel.
(*Note I pulled this from an application I've written - may not run as is,
but does give the objects you need to reference*)
Dim Cell_I as Long
Dim Cell_J as Long
Dim objDataCells As ISpssDataCells
Dim objExcelApp As Object
For Cell_I = 0 to lngNumRows-1
For Cell_J = 0 To lngNumColumns -1
ObjExcelApp.ActiveSheet.Cells(Cell_I,Cell_J).Value= objDataCells.ValueAt
(Cell_I,Cell_J)
Next
Next
James B. Luther, Ph.D.
Luther Consulting, LLC
jluther@lutherconsulting.com
-----Original Message-----
From: John S. Painter <painter@EMAIL.UNC.EDU>
Newsgroups: bit.listserv.spssx-l
To: SPSSX-L@LISTSERV.UGA.EDU <SPSSX-L@LISTSERV.UGA.EDU>
Date: Thursday, July 08, 1999 3:42 PM
Subject: script to send output to a specific cell within an excel worksheet
>Hello,
>
>I need to send a table to a specific place in a Excel worksheet. Currently
we copy-and-paste, we
>would like to automate this process, since it must be done about 600 times.
>
>I can use the "Export to excel.sbs" to send the table to a separate excel
file, but I really need to
>send it to a specific cell in an existing Excel file. Sending the table to
another file doesn't
>really solve the problem of cutting and pasting.
>
>John P
>
|