title: I am getting the Compile error:- sub or function not defined in Excel!! Please note the References in tool tab is not active
body: <pre><code>Private Sub CommandButton1_Click() 
      send email 
  End Sub
  
  Public Function sendmail() 
       On Error GoTo ende 
  
       esubject = "Systematic and Manually Created ASN" 
       sendto = "oo@hp.com" ccto = "rt@hp.com" 
       ebody = "Hello All" &amp; vbCrLf &amp; _
       "Please find the Systematically and Manually created ASN for the last month" &amp; _
        vbCrLf &amp; "With Regards" &amp; vbCrLf &amp; "Tarak" 
  
       newfilename = "C:\Stuff.XLS"
  
       Set apps = CreateObject("Outlook.Application") 
       Set itm = app.createitem(0)
  
       With itm 
           .Subject = esubject 
           .to = sendto 
           .cc = ccto 
           .body = ebody 
           .attachments.Add (newfilename) 
           .display 
           .Send 
       End With
  
       Set app = Nothing 
       Set itm = Nothing
  
  ende: 
  
  End Function
  </code></pre>