Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I have the following code to save the current workbook with a specific
filename. It is linked to a button launched from a custom menu. Sub Save_File() ' Macro to Save file as ZFPW_dd-mm-yyyy.xls Dim path As String, filename As String, filetype As String, file As String path = "C:\Documents and Settings\username\My Documents\SOX Reporting\Metrics" file_name = "ZFPW_" & Format(Date, "dd-mm-yyyy") filetype = ".xls" file = path & file_name & filetype ChDir path ActiveWorkbook.SaveAs filename:=file End Sub When I run the macro, I get "Compile error: Wrong number of arguments or invalid property assignment" with Format highlighted as the error. I'm sure it's a minor fix, but it's not giving me any love at the moment. Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm not seeing a problem here. What do you get when you do this
Debug.print Date Debug.print Format(Date, "dd-mm-yyyy") "D Zandveld" wrote: Hi, I have the following code to save the current workbook with a specific filename. It is linked to a button launched from a custom menu. Sub Save_File() ' Macro to Save file as ZFPW_dd-mm-yyyy.xls Dim path As String, filename As String, filetype As String, file As String path = "C:\Documents and Settings\username\My Documents\SOX Reporting\Metrics" file_name = "ZFPW_" & Format(Date, "dd-mm-yyyy") filetype = ".xls" file = path & file_name & filetype ChDir path ActiveWorkbook.SaveAs filename:=file End Sub When I run the macro, I get "Compile error: Wrong number of arguments or invalid property assignment" with Format highlighted as the error. I'm sure it's a minor fix, but it's not giving me any love at the moment. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Save workbook problem | Excel Programming | |||
Duplicating Changes from Column A and B of Master Workbook to ColumnA and B of Other Workbooks - - Please help me, I can save days if my problem | Excel Programming | |||
"Save" macro problem, still prompted to save when closing workbook (?) | Excel Programming | |||
Problem when attempting to save Workbook with VBA project protected | Excel Programming | |||
Save Workbook Problem | Excel Programming |