Our clients run XP pro and Office 2003 or 2007 and on server
We have a macro enabled document that pulls the user name from the registry and
applies it to the bottom of that document, similar to a signature.
The script below pulls the user name from AD and sets it in the registry in the
correct location. We need to do that because some of the office installs were
setup with "administrator" as the reg user and that is what shows up
on the document.
This script works well, but I need to set trusted locations in excel 2007 so
that the user won't have the select "enable the macros" to get the
document to run. The reg editor works well, but I wanted to combine them both
into one script. I am having trouble with the "nested" values such as
"path" allowsubfolders", etc. Plus I have not found the location
of the reg settings to set macro security to low on 2003 so the user can select
the enable the macros, otherwise the document won't run at all, or even prompt
then to enable.
Maybe someone who is wiser at VB than me that can help me combine these two and set the macro security for 2003.
Sets username Set objSysInfo = CreateObject("ADSystemInfo") strUser = objSysInfo.UserName Set objUser = GetObject("LDAP://" & strUser) strName = objUser.FullName Dim objShell, Office2K7Key, Office2KKey, TrustedLocation, Path, Allow Set objShell = Wscript.CreateObject("WScript.Shell") Office2K7Key ="HKEY_CURRENT_USERSoftwareMicrosoftOfficeCommonUserInfoUsername" Office2KKey = "HKEY_CURRENT_USERSoftwareMicrosoftOffice9.0CommonUserInfoUsername" objshell.RegWrite Office2K7Key ,(strName),"REG_SZ" objshell.RegWrite Office2KKey ,(strName),"REG_SZ" 'end here to set username REGEDIT to allow macros for 2007 Windows Registry Editor Version 5.00 [HKEY_CURRENT_USERSoftwareMicrosoftOffice12.0ExcelSecurityTrusted LocationsLocation6] "Path"="\dell7z34241sales" "AllowSubfolders"=dword:00000001 "Description"="Location of document" "Date"="9/21/2009 2:42 PM" [!--[If !supportLineBreakNewLine]--] [!--[endif]--]
April 28, 2010 3:51 PM
May 9, 2013 7:19 PM