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 (November 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 15 Nov 2005 00:43:48 -0500
Reply-To:     "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject:      Re: executing sas code in vba?
Comments: To: sas-l@uga.edu

suresh babu wrote: > =A0=0AHi All,=0A=0Ai was trying to run a small sas code in VBA.=0Ai > create= d a submit button in Excel. writen a small code that has toi > execute when t= he button is clicked.=0Athe code is as > follows.....=0A=0APrivate Sub Comman= dButton1_Click()=0A=0ADim > sSASCmd As String=0AsSASCmd =3D "proc printto log= > =3D'C:\starmodel\import.log' new;"=0AsSASCmd =3D sSASCmd & "LIBNAME > DA 'C:\= STARMODEL\';"=0AsSASCmd =3D sSASCmd & " proc printto log =3D > log;"=0AsSASCm= d =3D sSASCmd & "ENDSAS;"=0AMsgBox sSASCmd=0A=0ACall > Shell("C:\Program File= s\SAS Institute\SAS\V8\sas.exe", -nosplash - > Icon - initstmt & sSASCmd & vb= Hide)=0A=0AEnd Sub=0A=0Athis code is > not working.=0Acan any one tell or giv= e me advice on how to do > this?=0A=0A=0Athanks for ur time=0Asuresh=0A

You might be better off controlling the SAS session through the SAS com object.

Sub Button1_Click() Set oSas = CreateObject("SAS.Application") oSas.Visible = True oSas.Command ("AFA C=sashelp.games.main.frame") End Sub

Search for "Controlling SAS from Another Application Using OLE under Windows" in the help file for more information.

-- Richard A. DeVenezia http://www.devenezia.com/


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