1
我有一個VBA腳本象下面這樣:VBA Sub或功能,而在一類叫公共/私有子沒有定義錯誤
Sub button_click()
'
' < some code >
'
call FindStrings (strfolder, Nothing)
End Sub
Public Sub FindStrings(strFolder As String, Optional wksSheet As Worksheet = Nothing)
'
' < some code>
'
Call ProcessFolder(strFolder, strIndent, varStrings, varMatchesFound, varFileNames, lngFolderCount, lngFileCount)
End sub
Private Sub ProcessFolder(strFolder As String, ByRef strIndent As String, ByRef varStrings As Variant, ByRef varMatchesFound As Variant, ByRef varFileNames As Variant, ByRef lngFolderCount As Long, lngFileCount As Long)
'
' < some code>
'
Call ProcessFile(objFile.Path, strIndent, varStrings, varMatchesFound, varFileNames)
End sub
Private Sub ProcessFile(strFullPath As String, ByRef strIndent As String, ByRef varStrings As Variant, ByRef varMatchesFound As Variant, ByRef varFileNames As Variant)
'
' < some code>
'
End sub
目前,button_click
和FindStrings
處於Module
和ProcessFolder
和ProcessFile
在一個Class
。
當運行button_click
子程序中,它引發錯誤:
Sub or function not defined
會出現錯誤在對FindStrings的Call ProcessFolder...
線。
我已經搜索了很多與錯誤有關的問題子或函數沒有定義,也試圖實現他們的修改建議糾正此錯誤,但它不起作用。
有關這個錯誤是什麼以及如何糾正它的任何幫助,將不勝感激。
是那些都在同一模塊? –
不,我在標準模塊ProcessFolder()和ProcessFile()中放置了button_click()和FindStrings(),因爲我發現有人提到它可以解決錯誤,但它也可以工作。它們分爲四個不同的模塊@TimWilliams – S6633d
我將首先將它們全部放在同一個模塊中 –