We investigate theoretically the transition temperature of a weakly interacting F=1 spinor Bose-Einstein condensate (BEC) formed in an optical trap. The Hartree-Fock-Bogoliubov formalism for the spinor BEC is developed based on the mean-field theory for inhomogeneous systems at finite temperatures. The shift of the transition temperature due to finite-size effects and the two-body interaction is obtained simultaneously by analytically solving the coupled eigenvalue equations for quasiparticle excitations and amplitudes under Hartee-Fock-Bogoliubov and other relevant approximations. When applying this to the recent experiment of the all-optical formation of a spinor BEC with a condensate of 3.5×104 87Rb atoms [Phys. Rev. Lett. 87, 010404 (2001)], our calculations show that the condensation occurs at a temperature about 177 nK. An analytic result for the shift of the transition temperature in the presence of a weak magnetic field is also derived.