Expected: list separator or ) Error

  • Thread starter Thread starter Legacy 319654
  • Start date Start date
L

Legacy 319654

Guest
What am I missing? I have a macro workbook trying to save as .xlsx workbook in folder xlsx_xlsx.

I get compile error: Expected: list separator or )

Code:
Sub ssFile()

ActiveWorkbook.SaveAs ("C:\Users\pnix4\Desktop\xlsm_xlsx\HireTerm  “ & Format(Now(), “DD-MMM-YYYY”) & “.xlsx”)


End Sub

Thanks
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
What am I missing? I have a macro workbook trying to save as .xlsx workbook in folder xlsx_xlsx.

I get compile error: Expected: list separator or )

Code:
Sub ssFile()
  ActiveWorkbook.SaveAs [B][COLOR="#FF0000"]([/COLOR][/B]"C:\Users\pnix4\Desktop\xlsm_xlsx\HireTerm  “ & Format(Now(), “DD-MMM-YYYY”) & “.xlsx”[B][COLOR="#FF0000"])[/COLOR][/B]
End Sub
Your code worked fine for me once I replaced the "stylized" quote marks your code above is using with normal quote marks.

I would also note that you do not need the surrounding parentheses that I highlighted in red above.

I don't know if it was intentional or not, but you have two spaces after the word "HireTerm" (normally, I would expect only one space there).
 
Upvote 0
try this:

Code:
    ActiveWorkbook.SaveAs "C:\Users\pnix4\Desktop\xlsm_xlsx\HireTerm  " & Format(Now(), "DD-MMM-YYYY"), xlOpenXMLWorkbook

Edit: of course if the Activeworkbook is the workbook running the code then it will need to be in macro-enabled format: xlOpenXMLWorkbookMacroEnabled
 
Last edited:
Upvote 0
some of your quotes look funny

Code:
Sub Test()
    Dim a, b, c As String
    a = "C:\Users\pnix4\Desktop\xlsm_xlsx\HireTerm  “"
    b = Format(Now(), “DD - MMM - YYYY”)
    c = “.xlsx”
    
    MsgBox a & b & c
End Sub

this does not compile because of ... c = “.xlsx”

that is probably your problem

vba actually inserted a quote at the end of my a variable so vba is not liking your quote characters
 
Last edited:
Upvote 0
I am still missing sometime. It did not convert the .xlsm file to xlsx format.

Code:
ActiveWorkbook.SaveAs ("C:\Users\pnix4\Desktop\HireTerm  " & Format(Now(), "DD-MMM-YYYY") & ".xlsx")
 
Upvote 0
I get an error message "the following feature can not be saved as a macro free workbook"
ActiveWorkbook.SaveAs "C:\Users\pnix4\Desktop\aaaaaHireTerm " & Format(Now(), "DD-MMM-YYYY"), xlOpenXMLWorkbook

This code makes another Macro file
ActiveWorkbook.SaveAs "C:\Users\pnix4\Desktop\aaaaaHireTerm " & Format(Now(), "DD-MMM-YYYY"), xlOpenXMLWorkbookMacroEnabled

For some reason I can not get it to convert from macro to non macro file.
 
Last edited by a moderator:
Upvote 0
that is not an error but a notification I believe... try disabling notifications so excel performs the default action to the notification, i think it is just a warning that you will lose vba code
 
Last edited:
Upvote 0
Thank all for the help

Sub ssFile()

Application.DisplayAlerts = False


ActiveWorkbook.SaveAs "C:\Users\pnix4\Desktop\jjjjjjjHireTerm " & Format(Now(), "DD-MMM-YYYY"), xlOpenXMLWorkbook

Application.DisplayAlerts = True

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,314
Messages
6,171,393
Members
452,398
Latest member
InvoicingNoob

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top