自动保存将文件名保存为“ true”或“ false”

时间:2018-07-21 06:15:34

标签: excel excel-vba save filenames

宏出了点问题,它一直保存我想要的方式,但是将文件命名为“ true”或“ false”。注意:单元格值本身是“ = today()”

Sub Macro1()
'
' Macro1 Macro

ActiveWorkbook.SaveAs Filename = Range("C6").Value

    FileFormat = xlOpenXMLWorkbookMacroEnabled

        CreateBackup = False


ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF

    Filename = Range("c6").Value

        FileFormat = pdf

            Quality = xlQualityStandard

                IncludeDocProperties = True

                    IgnorePrintAreas = False

                        OpenAfterPublish = False

 End Sub

1 个答案:

答案 0 :(得分:0)

尝试使用Filename:=Range("c6").Text获取日期,该日期将显示在单元格中。

运算符语法为参数名称和参数值之间的:=

Sub Macro1()
    ActiveWorkbook.SaveAs _
      Filename:=Range("C6").Text, _
      FileFormat:=xlOpenXMLWorkbookMacroEnabled, _
      CreateBackup:=False
    ActiveSheet.ExportAsFixedFormat _
      Type:=xlTypePDF, _
      Filename:=Range("c6").Text, _
      FileFormat:=xlpdf, _
      Quality:=xlQualityStandard, _
      IncludeDocProperties:=True, _
      IgnorePrintAreas:=False, _
      OpenAfterPublish:=False
End Sub