我试图将多个parameters
传递给子例程,但是出现以下错误:
不正确的嵌套:在语句“ FORM”之前,“ FORM”引入的结构必须以“ ENDFORM”结束
这是我的代码:
CASE p_choose.
WHEN 'UMK'.
PERFORM umk USING: p_modul,
p_e_pal,
p_vbeln,
p_e_umk.
"some other cases
ENDCASE.
FORM umk USING: p_modul,
p_e_pal,
p_vbeln,
p_e_umk.
ENDFORM.
我的错误在哪里?如何传递多个参数?还是根本不可能?谢谢!
答案 0 :(得分:3)
我已经找到了解决方案。 错误是每个参数后面的“,”。
正确的代码是:
CASE p_choose.
WHEN 'UMK'.
PERFORM umk USING p_modul
p_e_pal
p_vbeln
p_e_umk.
"some other cases
ENDCASE.
FORM umk USING p_modul
p_e_pal
p_vbeln
p_e_umk.
ENDFORM.
答案 1 :(得分:3)
为了完成您自己的答案,这是正确的解决方案,让我通过显示等效代码而不显示链接语句来解释错误原因thread的误操作。
带有链接语句(符号Sub multimacro_test()
Dim wbOpen As Workbook
Dim MyDir As Variant
Dim c As Range
Dim location As String
MyDir = InputBox("Paste here the folder where you excel files are located.")
strExtension = Dir(MyDir & "\*.xlsx")
While strExtension <> vbNullString
Set wbOpen = Workbooks.Open(MyDir & "\" & strExtension)
With wbOpen
Dim foundcell As Range
Set foundcell = wbOpen.Sheets(1).Rows(1).Find("English")
If Not foundcell Is Nothing Then
Dim col As Long
col = foundcell.Column
End If
Range(Cells(1, col), Cells(9999, col)).Copy Range(Cells(1, col + 1), Cells(9999, col + 1))
If col <> 1 Then Range(Columns(1), Columns(col)).Hidden = True
Range(Cells(1, col + 1), Cells(1, col + 1)).Value = "Translation"
Rows(1).Hidden = True
.Close Savechanges:=True
End With
strExtension = Dir
Wend
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
和:
)的旧代码:
,
完全等同于此代码,没有链接的语句:
FORM umk USING: p_modul,
p_e_pal,
p_vbeln,
p_e_umk.
ENDFORM.
因此出现明显的语法错误。