Set obj = CreateObject("Excel.Application")
'addin_dir = obj.Application.UserLibraryPath
addin_dir = obj.Application.StartupPath
obj.Application.Quit
set obj = nothing

Set obj = CreateObject("Scripting.FileSystemObject")
current_dir = obj.GetParentFolderName(WScript.ScriptFullName)
Set obj = Nothing

on error resume next
Set obj = CreateObject("Scripting.FileSystemObject")
obj.CopyFile current_dir & "\Files\MARS.xlam", addin_dir & "\MARS.xlam"

If obj.FileExists(addin_dir & "\EMF Pro.xlam") Then
	obj.DeleteFile addin_dir & "\EMF Pro.xlam"
End if
Set obj = Nothing

If(Err.Number <> 0) then
	Msgbox "Addin Installation Failed ! Please make sure of the following" & vbNewLine & vbNewLine & "1. Unzip/Extract the downloaded file 'MARS.zip' before installing !" & vbNewLine & vbNewLine & "2. Excel is closed !" & vbNewLine & vbNewLine & "[Error Description : " & Err.Description & "]"
Else
	Msgbox "Addin Installation Successful !" & vbNewLine & "Please reopen excel for the addin to load automatically"
End if
