Well I must say that the reason why the upper code does not work, is beyond me. You could try to replace next line in code:
CATIA = GetObject(vbNullString, "CATIA.Application")
with
CATIA = System.Runtime.InteropServices.Marshal.GetActiveObject("CATIA.Application")
or check in this...