简体   繁体   中英

Excel Export Classic Ap Leading Zeros

I'm trying to add the leading zeros to my excel export file but it keeps removing my zeroes.

dteThisDob = rs("dob")
strThisDobYear = year(dteThisDob)
strThisDobMonth = right("0" & month(dteThisDob),2)
strThisDobDay = right("0" & day(dteThisDob),2)
strDob = strThisDobMonth & strThisDobDay & strThisDobYear 

This give me the output in excel 3041975. What I'm looking for is 03041975

您可以通过在字符串前加上TAB字符来强制 Excel 不将字符串转换为数值(并通过这样做删除前导零)。

strDob = Chr(9) & strThisDobMonth & strThisDobDay & strThisDobYear

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM