VBA:如何让此代码写入 3 位数的文件名?
我使用以下代码从活动 PPT 文件导出 PNG 文件。我发现我需要文件名是三位数字。我需要“001.png”、“002.png”等,而不是“01.png”、“02.png”等。
你能帮助我吗?我尝试过
sImageName = Format(oSlide.SlideIndex, "000") & ".png"
,但没有成功。
导出有效的部分代码:
For Each oSlide In ActivePresentation.Slides
sImageName = Format(oSlide.SlideIndex, "00") & ".png"
oSlide.Export sImagePath & sImageName, "PNG"
Next oSlide
提前谢谢您!
I'm using the following code to export PNG file from the active PPT file. I find that I need the file names to be THREE digits. Instead of "01.png", "02.png", etc., I need "001.png", "002.png", etc.
Can you help me? I tried
sImageName = Format(oSlide.SlideIndex, "000") & ".png"
but that didn't work.
Export section code that does work:
For Each oSlide In ActivePresentation.Slides
sImageName = Format(oSlide.SlideIndex, "00") & ".png"
oSlide.Export sImagePath & sImageName, "PNG"
Next oSlide
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经找到了解决方案,格式应设置为“000”而不是“00”
此代码在 Powerpoint 2010 中正确运行
并生成类似“001.png”的文件名
You have got the solution, the format should be set to "000" instead of "00"
This code runs correctly in Powerpoint 2010
and produces file names like "001.png"