MartyConnelly
martyconnelly at shaw.ca
Wed Jan 10 18:59:17 CST 2007
Some snippets that might help You may have to use code to open the form in design view to get at module text For Each ctl In Me.Controls Select Case TypeName(ctl) 'Case "TextBox" _ ' , "ComboBox" _ ' , "CommandButton" _ ' , "ListBox" _ ' , "Label" ' ctl.Font = "Arial" ' ctl.FontSize = 10 Case "CommandButton" Debug.Print ctl.Name; ctl.Properties.Item("OnClick").Value 'note the above property name has spaces removed 'this print line returns ButtonName [Event Procedure] 'tells you a module is associated with button End Select Next ctl or to get the code behind the form Dim strFrmName As String Dim loForm As Form Dim loMod As Module Dim pkType As Long strFrmName = Me.Form.Name DoCmd.OpenForm strFrmName, acDesign Set loForm = Forms(strFrmName) Debug.Print loForm.Name; ".HasModule = "; loForm.HasModule If loForm.HasModule = True Then Set loMod = loForm.Module On Error Resume Next Debug.Print loMod.CountOfDeclarationLines ' Number of Declares for form module Debug.Print loMod.CountOfLines ' Number of module lines of code for form. Debug.Print loMod.Name ' form name being interogated Debug.Print loMod.Lines(1, loMod.CountOfLines) ' List All Module lines of code 'I guess you have to use this to find start and end of proc lines 'Debug.Print loMod.Find("PART", 1, 1, loMod.CountOfLines, 1000, False, False, True) ' returns true if "part" is found 'Debug.Print loMod.ProcStartLine("OutputToHTML_Click", pkType) End If Exit_OutputToHTML_Click: Exit Sub Martin Reid wrote: >Is it possible to check every form buttons on click property to see if they are using Event Procedures or Embedded macros. If using macros is there a way to capture the text of the macro? > >Martin > >Martin WP Reid >Training and Assessment Unit >Riddle Hall >Belfast > >tel: 02890 974477 > > > > >------------------------------------------------------------------------ > >No virus found in this incoming message. >Checked by AVG Free Edition. >Version: 7.5.432 / Virus Database: 268.16.7/618 - Release Date: 06/01/2007 7:47 PM > > -- Marty Connelly Victoria, B.C. Canada