function commit(h)

if ~isempty(h.comhandle) && strcmp(h.Readonly,'off')
    if ~h.comhandle.Parent.ReadOnly
        try
            h.comhandle.Parent.Save;
        catch
            errstr = ['COM Error: ' lasterr];
            rethrow(errstr)
        end
    else
        error('Workbook is read only')
    end
else
    error('Data source is empty or read only')
end
