简体   繁体   English

Excel 导出经典 Ap 前导零

[英]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.我正在尝试将前导零添加到我的 excel 导出文件中,但它一直在删除我的零。

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这给了我 excel 3041975 的输出。我要找的是 03041975

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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