【问题标题】:Make file name containing date (VBA)制作包含日期的文件名(VBA)
【发布时间】:2012-04-12 12:07:40
【问题描述】:

我想在一个目录下保存一个文件,文件名应该是这样的格式:

iTerm Metrics Report Apr 12

即根文件名“iTerm Metrics Report”,后跟今天的日期,格式为三个字母的月份,然后是月份中的某天。

如何制作这样的文件名?

【问题讨论】:

  • Please help me on this. 当然 :) 到目前为止你尝试过什么?
  • sFile = "iTerm metrics Report" & "" & Format(Date) & ".xls" ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\706849\My Documents\Metric Report\ " & s文件

标签: vba excel


【解决方案1】:

sFile = "iTerm metrics Report" & "" & Format(Date) & ".xls" ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\706849\My Documents\Metric Report\" & sFile – Arul服务 5 秒前

这是你正在尝试的吗?

sFile = "iTerm metrics Report " & Format(Date,"mmm yy") & ".xls"

跟进

谢谢...但我正在尝试日期(4 月 12 日)12 不是一年的日期...请相应地建议我...谢谢 – Arul Servin 55 秒前

在这种情况下,将代码更改为

sFile = "iTerm metrics Report " & Format(Date,"mmm dd") & ".xls"

【讨论】:

  • 谢谢...但我正在尝试日期(4 月 12 日)12 不是一年...请相应地建议我...谢谢
  • sFile = "iTerm metrics Report " & Format(Date,"mmm DD") & ".xls" 是否正确?
猜你喜欢
  • 2022-12-22
  • 2021-09-12
  • 2010-11-12
  • 1970-01-01
  • 2019-04-11
  • 2012-02-06
  • 2014-07-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多