Saving Excel workbook to constant path with filename from two fields

114,595

Ok, at that time got it done with the help of a friend and the code looks like this.

Sub Saving()

Dim part1 As String

Dim part2 As String


part1 = Range("C5").Value

part2 = Range("C8").Value


ActiveWorkbook.SaveAs Filename:= _

"C:\-docs\cmat\Desktop\pieteikumi\" & part1 & " " & part2 & ".xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False

End Sub

How do I edit this part (FileFormat:= _ xlOpenXMLWorkbookMacroEnabled) for it to save as Excel 97-2013 Workbook, have tried several variations with no success. Thankyou

Seems, that I found the solution, but my idea is flawed. By doing this FileFormat:= _ xlOpenXMLWorkbook, it drops out a popup saying, the you cannot save this workbook as a file without Macro enabled. So, is this impossible?

Share:
114,595
Martins Atvars
Author by

Martins Atvars

Updated on December 17, 2020

Comments

  • Martins Atvars
    Martins Atvars over 3 years

    I tried to search and put together a code to fit my purpose.

    Sub save()
    ActiveWorkbook.SaveAS Filename:="C:\-docs\cmat\Desktop\New folder\ck.xls", FileFormat:= _
      xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
      , CreateBackup:=False
    End Sub
    

    How to edit this to: Instead of naming the saved file ck.xls, generate the filename from the worksheet cells C5 and C8, with a space in the middle.

  • Martins Atvars
    Martins Atvars over 10 years
    I wanted to save it without the macros at all. But it seems, that all is working fine and colleagues have no problems with the files being saved with this extension.