luohui 2009-07-23
代码如下:
'/*========================================================================= ' * Intro 主要是解决在使用WebBrowser打印时,得先设置IE安全性的问题 ' * FileName 添加网站到安全站点.设置安全站点打开ActiveX时提示.去页眉页脚.vbs ' * Author yongfa365 ' * Version v1.0 ' * Email yongfa365[at]qq.com ' * MadeTime 2009-06-18 23:12:55 ' * LastModify 2009-06-18 23:12:55 ' *==========================================================================*/ Const HKEY_CURRENT_USER = &H80000001 Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") '添加网站到安全站点 strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\yongfa365.com" objReg.CreateKey HKEY_CURRENT_USER, strKeyPath objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, "http", 2 '设置安全站点打开ActiveX时提示 strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2" objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, "CurrentLevel", "00000000" objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, "1201", "00000001" '取消页眉页脚 strKeyPath = "Software\Microsoft\Internet Explorer\PageSetup\" objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, "header", "" objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, "footer", "" msg = "IE安全设置完成"&vbCrLf&vbCrLf msg = msg & "如果还不能正常打印,你需要关闭所有打开的IE浏览器窗口,然后再登录OA进行打印"&vbCrLf&vbCrLf msg = msg & "如果还是有问题,您可以联系技术组:柳永法 " MsgBox msg, vbInformation, "温馨提醒!"