Hello all,
I would like to have a button on a form which will save the sheet named as the value of a cell..
The button is not a problem, assigning a macro to it neither,
But when I run this macro
Sub SaveFileWithCellValue()
Dim FileName As String
Dim FilePath As String
FileName = Sheets("Eindtest").Range("D2").Value
FilePath = "G:\P1-P3\Dennis\EindtestForms" & FileName & ".xlsm"
ActiveWorkbook.SaveAs FileName:=FileName, FileFormat:=xlOpenXMLWorkbook
End Sub
I get the following message:
Where do I go wrong?
The form/sheet is already in .xlsm format and the target folder also already contains other .xlsm files.
Thank you.
I would like to have a button on a form which will save the sheet named as the value of a cell..
The button is not a problem, assigning a macro to it neither,
But when I run this macro
Sub SaveFileWithCellValue()
Dim FileName As String
Dim FilePath As String
FileName = Sheets("Eindtest").Range("D2").Value
FilePath = "G:\P1-P3\Dennis\EindtestForms" & FileName & ".xlsm"
ActiveWorkbook.SaveAs FileName:=FileName, FileFormat:=xlOpenXMLWorkbook
End Sub
I get the following message:
Where do I go wrong?
The form/sheet is already in .xlsm format and the target folder also already contains other .xlsm files.
Thank you.