2,462
社区成员
发帖
与我相关
我的任务
分享
'密文Function测试
Public Sub SampleEncryptVBA()
Dim oAdd As Object, obj As Variant
Dim modulename$, vbafilefullpath$, ret
'建立VBA动态调用
On Error Resume Next
Set oAdd = GetObject(, "SmartIndenterVBE.Connect")
If Err <> 0 Then
MsgBox "请按Alt-F11进入一次VBE之后再运行宏!"
End
End If
Set obj = oAdd.Instance
Call obj.SetExcelApp(Application)
'要运行的代码文件
vbafilefullpath = ThisWorkbook.Path & Application.PathSeparator & "Encryptedemo.txt"
'RunVBAFunction是运行VBA函数,参数:文件名,文件密钥,文件编码,函数名,函数参数1,函数参数2,函数参数3...(超过五个请使用不定参数)
ret = obj.RunVBAFunction(vbafilefullpath, "abc", True, "ReturnRangeValue", Range("A1"))
MsgBox ret
End Sub