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
我将首先将它们全部放在同一个模块中 –