|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
各位大侠好,
最近在学习一些专业计算的代码,VBA窗体的最后一步是 “完成计算”,正常情况下应该会根据程序将计算结果写入到新建的Sheet里。但是在我的电脑上就出现了”ActiveX部件无法创建对象“的问题。我已经把涉及到的所有的System32下的dll都安装了。
窗体最后一步的按钮和出错图片如下图:
然后点击 调试后出来的代码是:
- Set ClassCalcule = CreateObject("aabbcc32.CLS_calcule")
- SRR_NH4_AM_T = ClassCalcule.SRR_NH4_AM_T(CN_Ratio, Media_Type(3), Temp(3), DF_AM_SRR_NH)
- AM_SRR_CN = ClassCalcule.AM_SRR_CN(CN_Ratio, Media_Type(3), Temp(3))
复制代码 然后找到ClassCalcule的定义代码如下:
- Public ClassPXLS As Object
- Public <b>ClassCalcule</b> As Object
- Public Ret_clear_code As String
- #If VBA7 Then
- Public Declare PtrSafe Function ShellExecute Lib "<b>shell32.dll</b>" Alias "ShellExecuteA" (ByVal HWnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
- Public Declare PtrSafe Function SHGetFolderPath Lib "shell32.dll" Alias "SHGetFolderPathA" (ByVal HWnd As LongPtr, ByVal csidl As LongPtr, ByVal hToken As LongPtr, ByVal dwFlags As LongPtr, ByVal pszPath As String) As Long
- #Else
- Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal HWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
- Public Declare Function SHGetFolderPath Lib "shell32.dll" Alias "SHGetFolderPathA" (ByVal HWnd As Long, ByVal csidl As Long, ByVal hToken As Long, ByVal dwFlags As Long, ByVal pszPath As String) As Long
- #End If
复制代码 还有一小段关于Scripting.filesystemobject的,如下:
- Public Function ExisteFichier(s As String) As Boolean
- Dim pdx As Object
- Set pdx = CreateObject("Scripting.FileSystemObject")
- ExisteFichier = pdx.FileExists(s)
- End Function
复制代码 我已经完全没主意了,哪位大侠帮忙看看。
多谢大家。
|
|