tt1212 > 18-05-15, 10:48 PM
Function ReferenceFromFile(strFileName As String) As Boolean
Dim ref As Reference
On Error GoTo Error_ReferenceFromFile
References.AddFromFile (strFileName)
ReferenceFromFile = True
Exit_ReferenceFromFile:
Exit Function
Error_ReferenceFromFile:
ReferenceFromFile = False
Resume Exit_ReferenceFromFile
End Function
Function AddReference()
Dim strPath1 As String
Dim strPath2 As String
Dim strPath3 As String
Dim strPath4 As String
Dim strPath5 As String
Dim strPath6 As String
Dim strPath7 As String
strPath1 = CurrentProject.Path & "\Library\VBE6.DLL"
Call ReferenceFromFile(strPath1)
strPath2 = CurrentProject.Path & "\Library\msado21.tlb"
Call ReferenceFromFile(strPath2)
strPath3 = CurrentProject.Path & "\Library\msadox28.tlb"
Call ReferenceFromFile(strPath3)
strPath4 = CurrentProject.Path & "\library\msjro.dll"
Call ReferenceFromFile(strPath4)
strPath5 = CurrentProject.Path & "\Library\MSO.DLL"
Call ReferenceFromFile(strPath5)
strPath6 = CurrentProject.Path & "\library\stdole2.tlb"
Call ReferenceFromFile(strPath7)
strPath6 = CurrentProject.Path & "\library\MSACC.OLB"
Call ReferenceFromFile(strPath7)
Shell "C:\WINDOWS\system32\regsvr32.exe /s strPath1, vbNormalNoFocus"
Shell "C:\WINDOWS\system32\regsvr32.exe /s strPath2, vbNormalNoFocus"
Shell "C:\WINDOWS\system32\regsvr32.exe /s strPath3, vbNormalNoFocus"
Shell "C:\WINDOWS\system32\regsvr32.exe /s strPath4, vbNormalNoFocus"
Shell "C:\WINDOWS\system32\regsvr32.exe /s strPath5, vbNormalNoFocus"
Shell "C:\WINDOWS\system32\regsvr32.exe /s strPath6, vbNormalNoFocus"
Shell "C:\WINDOWS\system32\regsvr32.exe /s strPath7, vbNormalNoFocus"
End Function
-viết hai hàm đó trong một Moduel sau đó chạy jhamf AddReference() trong Macro Autoexec là được các bạn thử xem. ai có kinh nghiệm nào hay hơn không?
-Chú ý các thư viện mình sẽ đăt trong thư mục Library ứng dụng của mình là OK rồi