DIM AccessShell, strPathToAccess, strCurrentPath, WshShell, strSecurity
Const OverwriteExisting = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "Турникет2011.mdb" , "C:\BASE\Turniket.mdb" , OverwriteExisting
If Err.Number Then
WScript.Echo "Ошибка копирования."
End if
Set AccessShell = CreateObject("Access.Application")
strAccessVersion = AccessShell.SysCmd(7)
Select Case strAccessVersion
Case "11.0"
strSecurity = "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Access\security\Level"
Case "12.0"
strSecurity = "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\VBAWarnings"
End Select
Set WshShell = CreateObject("WScript.Shell")
' Понижаем безопасность
If WshShell.RegRead(strSecurity) <> 1 Then
WshShell.RegWrite strSecurity, 1, "REG_DWORD"
End If
strPathToAccess = AccessShell.sysCmd(9) & "MSACCESS.EXE "
'WScript.Echo strPathToAccess
strCurrentPath ="C:\BASE\Turniket.mdb"
'WScript.Echo strCurrentPath
Set WshShell = CreateObject("WScript.Shell")
Set AccessShell = WshShell.Exec(strPathToAccess & """" & strCurrentPath)
|