llarava
asked on
Normal.dot replacement script (vb script)
Hi,
I am not really familiar with scripting however I am trying to modify the following script. The goal is to replace the normal.dot that is located in C:\Program Files\Microsoft Office\Templates
The script below does more since it looks for the user name, renames the file, etc...
Basically the script has to be simplified so the normal.dot gets copied from the server share to the C:\Program Files\Microsoft Office\Templates location.
No need for the file to be renamed and user to be identified since it is place in C:\Program Files instead of the users profile.
Thanks!
Dim objFSO : Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
Dim objNetwork : set objNetwork = CreateObject("Wscript.Netw ork")
Dim objShell : Set objShell = CreateObject("Wscript.Shel l")
strPath = "C:\Documents and Settings\" & objNetwork.UserName
If objFSO.FileExists (strPath & "\application data\microsoft\templates\n ormal.dot" ) Then
If objFSO.FolderExists(strPat h & "\application data\microsoft\templates\o ld-normal" ) = False Then
objFSO.CreateFolder strPath & "\application data\microsoft\templates\o ld-normal"
End If
objFSO.CopyFile strPath & "\application data\microsoft\templates\n ormal.dot" , strPath & "\application data\microsoft\templates\o ld-normal\ "
End If
objShell.Run "taskkill /IM winword.exe",1,true
objFSO.CopyFile "\\server\Shared\Normal.do t", strPath & "\application data\microsoft\templates\" , True
I am not really familiar with scripting however I am trying to modify the following script. The goal is to replace the normal.dot that is located in C:\Program Files\Microsoft Office\Templates
The script below does more since it looks for the user name, renames the file, etc...
Basically the script has to be simplified so the normal.dot gets copied from the server share to the C:\Program Files\Microsoft Office\Templates location.
No need for the file to be renamed and user to be identified since it is place in C:\Program Files instead of the users profile.
Thanks!
Dim objFSO : Set objFSO = CreateObject("Scripting.Fi
Dim objNetwork : set objNetwork = CreateObject("Wscript.Netw
Dim objShell : Set objShell = CreateObject("Wscript.Shel
strPath = "C:\Documents and Settings\" & objNetwork.UserName
If objFSO.FileExists (strPath & "\application data\microsoft\templates\n
If objFSO.FolderExists(strPat
objFSO.CreateFolder strPath & "\application data\microsoft\templates\o
End If
objFSO.CopyFile strPath & "\application data\microsoft\templates\n
End If
objShell.Run "taskkill /IM winword.exe",1,true
objFSO.CopyFile "\\server\Shared\Normal.do
ASKER
I would like to keep the same type of script. With the IF structure and also the taskkill /IM.
Could anyone help out?
Could anyone help out?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try This
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objNetwork : set objNetwork = CreateObject("Wscript.Network")
Dim objShell : Set objShell = CreateObject("Wscript.Shell")
strPath = "C:\Program Files\Microsoft Office\Templates"
If objFSO.FileExists (strPath & "normal.dot") Then
If objFSO.FolderExists(strPath & "\old-normal") = False Then
objFSO.CreateFolder strPath & "\old-normal"
End If
objFSO.CopyFile strPath & "\normal.dot", strPath & "\old-normal\"
End If
objShell.Run "taskkill /IM winword.exe",1,true
objFSO.CopyFile "\\server\Shared\Normal.dot", strPath & "\", True
net use x: /DELETE
net use x: \\server\Shared\
x:
copy normal.dot "C:\Program Files\Microsoft Office\Templates\"
put this into .bat file and then run