Have you looked at the UDF library? There already is a function to return the MS Office type: MS Office Type