in reply to Error 317 saving spreadsheet

GetLastError is only meaningful after a system call returns an error. It's wrong to use it there.