Submitted By: Kent Finkle

Configures to default file path in Microsoft Excel so that it points to the user's home directory.

PowerShell
Edit|Remove
$comments = @'
Script name: Set-DefaultFilePath.ps1
Created on: Tuesday, July 10, 2007
Author: Kent Finkle
Purpose: How can I use Windows Powershell to
Set the Default File Path in Excel to a User’s Home Directory?
'@
#-----------------------------------------------------
function Release-Ref ($ref) {
([System.Runtime.InteropServices.Marshal]::ReleaseComObject(
[System.__ComObject]$ref) -gt 0)
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers() 
}
#-----------------------------------------------------
$xl = new-object -comobject excel.application
$xl.DefaultFilePath = $home
$a = $xl.Quit()
$a = Release-Ref $xl