| Date: | Wed, 25 Apr 2001 09:18:38 -0700 |
| Reply-To: | Gwen Hyatt <gwen_hyatt@RMCCORP.COM> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
| From: | Gwen Hyatt <gwen_hyatt@RMCCORP.COM> |
| Subject: | Re: Output to word and Powerpoint |
| Content-Type: | text/plain; charset="iso-8859-1" |
|---|
David,
I've found the trick is to format text and tables in Word after I send them
there, which can also be done using Scripts. For instance, the simple SPSS
script below selects all text in an open Word file and changes the font to
Times New Roman 12. In order to write the code to control Word, I simply
record macros in Word then copy that code into SPSS and add "objWord." as
needed. This process took a bit of experimentation, but it has been worth
it.
Gwen
Sub Main
'Get reference to the open Word document
Dim objWord As Object
Set objWord = GetObject(,"Word.Application")
'Select all text and change the font
objWord.Selection.WholeStory
objWord.Selection.Font.Name = "Times New Roman"
objWord.Selection.Font.size = 12
End Sub
___________________________________
Gwen Hyatt, Research Associate
RMC Research Corporation
522 SW Fifth Avenue, Suite 1407
Portland, OR 97204
(503) 223-8248 / (800) 788-1887
gwen_hyatt@rmccorp.com
-----Original Message-----
From: David Lindsay [mailto:spss@SDRESEARCH.COM]
Sent: Tuesday, April 24, 2001 12:36 PM
Subject: Output to word and Powerpoint
I am using SPSS 9, and can copy-and-paste SPSS Pivot
Tables into Microsoft Word using copy as *object*. There is a script
in the exchange called Export_To_Word_RTF.sbs at
http://www.spss.com/software/spss/scriptexchange/export.htm
<http://www.spss.com/software/spss/scriptexchange/export.htm> and pastes
tables as text or as a picture. Neither options copy tables properly
into Office 2000, the pictures option seems to show only part of the
table ie it loses 20% of the right hand side.
I have a similar problem moving charts into Powerpoint. Manually I can
use the copy-and-paste option to get good quality fonts whereas using
the Script Exchange Script (that uses Metafiles transfer) gives poor
quality fonts.
Has anybody rewitten both of the scripts, as they are both useless for
my purposes. I have not posted them whole as they are quite large but
the relevant bits are:
Export-to Word.sbs,
'******************************************************
'uncomment the following line if pasting as a picture
PasteIntoWord objItem, "Pict"
'******************************************************
Export-to-Powerpoint,
For i = 0 To intItemCount - 1
Set objItem = objItems.GetItem(i)
intItemType = objItem.SPSSType
If intItemType = SPSSChart Then
Set objSPSSChart = objItem.ActivateChart
'create a temporary windows metafile
objSPSSChart.ExportChart ("c:\temp\rvctmp.wmf",
"Windows Metafile")
SendKeys "(^c)", True
AppActivate "Microsoft PowerPoint"
'insert the meta file
SendKeys "(%IPF)", True
SendKeys "c:\temp\rvctmp.wmf~"
SendKeys "%IN~", True
SendKeys "^A%ET", True
objItem.Deactivate
' i=IntItemCount
End If
Next i
End If
AppActivate "Microsoft PowerPoint"
SendKeys "%FA",1
strDocument=InputBox$("Name the document you want to save to:")
SendKeys strDocument, True
SendKeys "%FX", True
End Sub
Thanks for your help.
--
David Lindsay
Significantly Different! Research, Reading,Berks. GB
Market Research Services & Consultancy
mailto: davidL@SDResearch.com
http://www.SDResearch.com/
|