我遇到了一个问题。我正在尝试定义在类模块中的几个方法中使用的几个变量。
我一直收到invalid outside procedure
错误。
谁能指出我正确的方向?我觉得这是一个范围问题,但我不确定如何验证这一点。
' class file_ops
' attributes
Private pdb_file As String
Private pdb_path As String
pdb_file = "db.xlsx"
pdb_path = ThisWorkbook.Path + "\"
Public Sub open_db(pdb_file, pdb_path)
Workbooks.Open Filename:=pdb_path + pdb_file
End Sub
Public Sub close_db(pdb_file)
pdb_file.Close SaveChanges:=False
End Sub