1
我有一個問題,我無法解決,直到現在。 我在窗體上放了一個按鈕。如果不寫代碼。我可以點擊它沒有任何問題。如果我寫了一些代碼然後評論這段代碼,我得到這個錯誤:Sub或函數未定義。我怎麼解決這個問題?vba中的子功能或函數未定義錯誤
Private Sub Command40_Click()
'Dim fso As New FileSystemObject
'Dim ts As TextStream
'Dim Name, Line As String
'Dim regn As New regexp
'Dim regx As New regexp
'Dim regend As New regexp
'Dim regxnum As New regexp
'Dim swknnf As Boolean
'Dim matchkennfeld, matchstx, matchend, matchxnum As MatchCollection
' Name = util1.fDateiName("*.DCM", "Text")
' Set ts = fso.OpenTextFile(Name, ForReading)
'Do While Not ts.AtEndOfStream
' set Line = ts.ReadLine
'regn.Pattern = "KENNFELD\s+([A-Z 0-9]*)"
' regx.Pattern = "\s*(ST/X)\s*([0-9]*\.[0-9]*\s*)+"
' regxnum.Pattern = "\s*[0-9]*\.[0-9]*\s*"
' regend.Pattern = "\s*(END)\s*"
' Set matchkennfeld = regn.Execute(Line)
' Set matchstx = regx.Execute(Line)
' Set matchend = regend.Execute(Line)
' If matchkennfeld.Count <> 0 Then
' swknnf = True
' End If
' If matchend.Count <> 0 Then
' swknnf = False
' End If
' If matchstx.Count <> 0 And swknnf = True Then
' Set matchxnum = regxnum.Execute(Mid(Trim(matchstx.Item(0)), 5))
' For Each Match In matchxnum
' MsgBox Match
' Next Match
' End If
'Loop
End Sub