>Public Function GetSProcCode(strProcedureName As String) >Dim cn As Object >Dim rs As Object >Dim strSelect As String > >strSelect = "select C.text from sysobjects O, syscomments C Where O.type = 'P' and C.id = O.id and text like " >strSelect = strSelect & "'%" & Trim(strProcedureName) & "%'" > >Set cn = CreateObject("ADODB.Connection") >-- open database with appropriate connection string >cn.Open "provider=sqloledb;data source=<YourDataSource>;initial catalog=<YourDataBase>", "<your login name>", "<your passsword>" > >Set rs = cn.execute(strSelect) >GetSProcCode = rs.fields("text").Value > >End Function > > >' and then... >Debug.Print GetSProcCode("up_MyProcedure") >>
"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams