April, 2007
Page 109



     on error -- if you cancel out of Save dialog for an unsaved doc, avoid error

          return

     end try

     set filePath to full name of frontDoc

end tell

In Excel:

tell application "Microsoft Excel"

     try

          set frontDoc to active workbook

     on error -- avoid error if no workbook open

          return

     end try

      set containerPath to path of frontDoc

     if containerPath = "" then -- unsaved

          activate

          set docName to name of frontDoc

          set filePath to (choose file name default name docName) as Unicode text

          if filePath does not contain "." then set filePath to filePath & ".xls"

          save frontDoc in filePath

     else -- already saved as file, re-save  

          save frontDoc

          set filePath to full name of frontDoc

     end if

end tell

In PowerPoint:

tell application "Microsoft PowerPoint"

try    

      set frontDoc to active presentation

on error -- avoid error if no presentation open

     return

end try

set containerPath to path of frontDoc

     if containerPath = "" then -- unsaved

          activate

          set docName to name of frontDoc

          set filePath to (choose file name default name docName) as Unicode text

          if filePath does not contain "." then set filePath to filePath & ".ppt"