kieu manh > 24-06-15, 07:21 PM
(24-06-15, 12:58 AM)standapro Đã viết:Tặng Cho Bạn Code Sau... Code này Mình viết trên Form VB6 sử dụng cho Excel bạn Copy về sửa lại key Registry và dòng Này của Access App.Path & Là OKcái này đâu thực hiện được reg đâu bạn, bạn xem lại đi bạnMã:Sub setReg() ' site: http://thuthuataccess.co.cc ' Write by Noname ' Vui long dung remove thong tin site va tac gia neu ban dung hoac share lai code nay Dim F As String F = "regedit.exe /s " & CurrentProject.Path CurrVerAccess = Application.Version Select Case Application.Version Case "11.0" F = F & "\ser2k3.reg" Call Shell(F) MsgBox "Set successfull " & F & ". Quit and reOpen to Effect" DoCmd.Quit Case Else MsgBox "Phien ban hien tai chung toi chua co file reg" End Select End Sub
Public Sub Enable_Macros()
Dim MyReg As String, Mybat As String
MyReg = App.Path & "\Register.reg"
Mybat = App.Path & "\temp.bat"
Open MyReg For Output As 1
Print #1, "REGEDIT4" & vbNewLine & _
"[HKEY_CURRENT_USER\Software\Microsoft\Office\" & CreateObject("Excel.Application").Version & _
"\Excel\Security]" & vbNewLine & """AccessVBOM""" & "=dword:00000001"
Print #1, "REGEDIT4" & vbNewLine & _
"[HKEY_CURRENT_USER\Software\Microsoft\Office\" & CreateObject("Excel.Application").Version & _
"\Excel\Security]" & vbNewLine & """VBAWarnings""" & "=dword:00000002" ''chi can thay doi "=dword:00000002" so 2 thanh so 1 la ok
Close #1
Open Mybat For Output As 2
Print #2, "regedit /s Register.reg" & vbNewLine & _
"Del Register.Reg" & vbNewLine & "Del temp.bat"
Close #2
Shell Mybat, vbHide
End Sub