'这是网上高手写的
Function AutoRegFile(FileName As String)
Dim reged As Boolean
Dim RegFile1 As String
Dim RegFile2 As String
Dim BeReg As String, strDtn As String, strDtn1 As String
Dim ref As Reference
Dim RetVal
BeReg = CurrentProject.Path & "\ocx\" & FileName '控件存放位置,例子中是放在工程当前目录下ocx子目录
strDtn = Environ("windir") & "\system\" & FileName '返回系统路径
strDtn1 = Environ("windir") & "\system32\" & FileName '返回系统路径
On Error Resume Next