Date: Fri, 9 Jul 1999 09:22:18 -0400
Reply-To: "John S. Painter" <painter@EMAIL.UNC.EDU>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "John S. Painter" <painter@EMAIL.UNC.EDU>
Subject: Re: script to send output to a specific cell within an excel
worksheet
In-Reply-To: <003101bec97b$0b80bfa0$032aa8c0@JamesLuther.501Server>; from
"painter" at Fri Jul 09 09:22:18 1999
Content-Type: TEXT/PLAIN; CHARSET="US-ASCII"
I can creae an Excel macro that copies from the new Excel output file to the one
I need...but how can I include this new Excel macro in the existing spss to
excel script? see the example below:
Here is the begining of the spss script, mention is made of telling Excel to
excute a macro: :
'Begin Description
'This script will export SPSS PivotTables into Excel using BIFF (Binary
Interchange File Format).
'It will also paste charts. Each item is pasted into its own sheet.
'End Description
'
'******************************************************
'You may wish to edit the Excel Macro (below), which
're-formats the table after it is pasted into Excel
'******************************************************
Sub ExcelMacro()
objExcelApp.Selection.AutoFormat Format:=&HFFFFEFC6, Number:=True, _
Font:=True, Alignment:=True, Border:=True, Pattern:=True, Width:=True
>>>>>>>>>'You could tell Excel to execute a macro here.<<<<<<<<<<<<<<
End Sub
'
'******************************************************
I need to insert this:
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 7/8/99 by School of Social Work
'
'
Range("A1:L13").Select
Selection.Copy
Windows("L1SHELL_1.XLS").Activate
Range("AA2").Select
ActiveSheet.Paste
End Sub
How can I simply insert another excel macro into the existing script so the the
new output will be copied and pasted to another worksheet??
TIA,
John P
-- Begin original message --
> From: "James B. Luther, Ph.D." <jluther@POP.NLCI.COM>
> Date: Thu, 8 Jul 1999 14:49:46 -0500
> Subject: Re: script to send output to a specific cell within an excel
> worksheet
> To: SPSSX-L@VM.MARIST.EDU
> Reply-To: "James B. Luther, Ph.D." <jluther@POP.NLCI.COM>
> Comments: To: "John S. Painter" <painter@EMAIL.UNC.EDU>
>
> 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
> >
>
-- End original message --