LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 23 Oct 2008 06:55:48 -0700
Reply-To:     patrick <patrick.pelletier@QUINTILES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         patrick <patrick.pelletier@QUINTILES.COM>
Organization: http://groups.google.com
Subject:      Re: DDE triplet for word 2007
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On Oct 22, 3:54 pm, gerhard.hellrie...@T-ONLINE.DE (Gerhard Hellriegel) wrote: > I also have no experience with DDE and Word. I only used sometimes DDE > between SAS and EXCEL. > > Maybe it's something similar, try it out: > > Start SAS and Word. Mark a area in Word, you want to use in SAS and switch > to SAS. I also have no SAS on my home PC, so from brain. There is something > like "Solutions" or maybe "Local"-"Solutions" in the PMENUs. Look there for > the entry "DDE-triplet". If you find something there you might use that for > the filename DDE word "triplet"; in SAS. > > If you do not see anything, try that: > From the online documentation: > > filename test dde 'winword|"c:\temp\testdde.doc" > !NUMBER' notab; > > NUMBER is a bookmark in Word. The bookmark seems to be needed to position > the cursor in the document, because you don't have rows and columns like in > EXCEL. > Just try it out, it should be independant of the Word version. > Gerhard > > On Wed, 22 Oct 2008 14:21:12 -0500, ./ ADD NAME=Data _null_, > > > > <iebup...@GMAIL.COM> wrote: > >I can't really help you with the DDE and I don't have WORD 2007. I > >will offer a program that I think will work with your version of Word. > > >This program can be modified to suite your working practice to > >accomplish the same task you are doing now with DDE. > > >The task being insert text data into a word document and set margins, > >font etc. and save it as a DOC. The following program does that. It > >takes input from a FILEREF reads that into WORD and saveAS to the file > >specified by another FILEREF. The communication methods via FILEREFS > >could be modified as required, where the output file name is derived > >from the SAS program name of other similar source. > > >data _null_ / pgm=work.Listing2Doc; > > attrib infile outfile script filevar command length=$256; > > infile = pathname('FT77F001'); > > outfile = pathname('FT78F001'); > > > script = catx('\',pathname('WORK'),'LISTING2DOC.vbs'); > > filevar = script; > > > /* write the script */ > > file dummy1 filevar=filevar; > > put 'Const ' infile=$quote258.; > > put 'Const ' outfile=$quote258.; > > put 'Const wdOrientLandscape = 1'; > > put 'Const wdPrintView = 3'; > > put 'Set objWord = CreateObject("Word.Application")'; > > put 'objWord.Visible = False'; > > put 'objWord.DisplayAlerts = False'; > > put 'Set objDoc = objWord.Documents.Add()'; > > put 'objDoc.PageSetup.Orientation = wdOrientLandscape'; > > put 'objDoc.PageSetup.TopMargin = "1.50 IN"'; > > put 'objDoc.PageSetup.BottomMargin = "1.00 IN"'; > > put 'objDoc.PageSetup.RightMargin = "1.00 IN"'; > > put 'objDoc.PageSetup.LeftMargin = "1.00 IN"'; > > put 'objDoc.ActiveWindow.View.Type = wdPrintView'; > > put 'objDoc.ActiveWindow.View.Zoom.Percentage = 100'; > > put 'Set objSelection = objWord.Selection'; > > put 'objSelection.InsertFile(infile)'; > > put 'Set objRange = objDoc.Range'; > > put 'objRange.Font.Size = "7"'; > > put 'objRange.Font.Name = "Courier New"'; > > put 'objdoc.SaveAs outfile'; > > put 'objWord.Quit'; > > > /* close the script file by opening another, not used */ > > filevar = catx('\',pathname('WORK'),'DUMMY.vbs'); > > file dummy1 filevar=filevar; > > > /* look at the script, not necessary but may be useful */ > > infile dummy2 filevar=script end=eof; > > do _n_ = 1 by 1 until(eof); > > input; > > putlog _n_ 3. +1 _infile_; > > end; > > > /* call the script */ > > command = catx(' ','cscript',quote(strip(script))); > > infile dummy3 pipe filevar=command end=eof; > > do until(eof); > > input; > > putlog _infile_; > > end; > > stop; > > run; > > >filename FT77F001 "%sysfunc(pathname(WORK))\PRINTTO.LST" lrecl=256; > >proc printto new print=FT77F001; > > run; > >proc report list nowd data=sashelp.shoes ls=150; > > columns _all_; > > run; > >proc printto; > > run; > > >filename FT78F001 '?CSIDL_PERSONAL\sampleListing.doc'; > >%Put NOTE %sysfunc(pathname(FT78F001)); > > >data pgm=work.listing2doc; > > run; > > >filename FT77F001 CLEAR; > >filename FT78F001 CLEAR; > > >On 10/22/08, patrick <patrick.pellet...@quintiles.com> wrote: > >> Hello, > >> I'm trying to output a proc report to word 2007 using DDE. The code > >> was working pretty well before we change from word 2002 to word 2007. > >> With the data _NULL_ I open the template and it's work. The bug is > >> with the proc printto. I got this error message ERROR: Physical file > >> does not exist,winword|R:\Utility\template_7pt.doc!start. I made a few > >> test but I didn't find how to write the DDE triplet for word 2007. Did > >> someone find it ? > > >> Thanks for your help. > >> Patrick Pelletier > > >> filename cmds dde 'winword|system'; > > >> data _NULL_; > >> FILE cmds; > >> PUT"[FileOpen.Name="R:\Utility\template_7pt.doc""]"; > >> run; > > >> FILENAME output DDE "winword|R:\Utility\template_7pt.doc!start" notab; > > >> proc printto PRINT=output NEW; > >> run; > > >> proc report... > > >> proc printto; > >> run;- Hide quoted text - > > - Show quoted text -

Hello,

I used the vb script and I was able to do what I wanted. Thanks!! Patrick


Back to: Top of message | Previous page | Main SAS-L page