I'm working on a MSI package which replaces some Excel addins with some localized versions of the addins. Facing a problem with the uninstall, since the locale files are replaced during installation, and the original files (non locale) are overwritten.

I was thinking of creating an VB script and running this script execute deferred before install, and one during uninstall.. However, i can't get the VB script to work properly. (that seems to be my problem most of the times.. Enough solutions, but geting them to work properly.. :P) This is what i've come up with so far:

dim filesys
dim progfolder
set filesys=CreateObject("Scripting.FileSystemObject")

If filesys.FolderExists("c:\program files\Microsoft Office\OFFICE11\Library\Analysis\") Then
Set progfolder = filesys.Getfolder("c:\program files\Microsoft Office\OFFICE11\Library\Analysis\")
progfolder.Copy("c:\program files\Microsoft Office\OFFICE11\Library\Analysis\EN\")
End If

So the general idea is to have the folder Analysis (or actually, only the contents) moved to Analysis\EN. However, the script tells me the directory c:\program files\Microsoft Office\OFFICE11\Library\Analysis\EN\ doesn't exist. If i change the target folder name to c:\test , the script runs fine. Probably something to do with the spaces in the path. (program files\microsoft office) Tried double quotes, & Chr(34), but still can't get it to work..

So i thought it might be an option to declare them as variables.. So i came up with this:

Dim strOldPath
Dim strNewPath
Dim Fso

strOldPath = "C:\Program Files\Microsoft Office\OFFICE11\Library\Analysis\ATPVBAEN.XLA"
strNewPath = "c:\Program Files\Microsoft Office\OFFICE11\Library\Analysis\EN\ATPVBAEN.XLA"

Set Fso = CreateObject("Scripting.FileSystemObject")

Set wshshell = WScript.CreateObject("WScript.Shell")
Fso.MoveFile strNewPath , strOldPath

But that doesn't help me either. Get a "File not found" error.. If i want to move the entire directory (omit the filenames) it doesn't work either. Any suggestions on how to go about this..? Heeeeelp..! [&:] Thanks..!
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


Hi neo,
first of all: Set wshshell = WScript.CreateObject("WScript.Shell") won't work on vbs called in MSI.
Use: Set wshshell = CreateObject("WScript.Shell") instead of.

Please specify exactly, how and where you call this script.

What happens, if you insert a messagebox statement into the script?

Regards, Nick
Answered 01/13/2007 by: nheim
Tenth Degree Black Belt

Please log in to comment
Fso.MoveFile strNewPath , strOldPath

the syntax is : object.MoveFile ( source, destination )

So shouldn't that be : Fso.MoveFile strOldPath,strNewPath


To handle spaces in the path you could try this :

strOldPath ="""" & "C:\Program Files\Microsoft Office\OFFICE11\Library\Analysis\ATPVBAEN.XLA" & """"

*Might* Work !!
Answered 01/18/2007 by: Flakes
Senior Yellow Belt

Please log in to comment