missfionaelizabeth
New Member
- Joined
- Oct 20, 2014
- Messages
- 10
Hi
I have a sheet that I want to use as a template that is filled in via userform. I cannot for the life of me figure out why the code to save the workbook won't work, so maybe somebody here can help!!
Once the form has been filled in I have a section of code to copy the template sheet into a new workbook. I want the new workbook to Save As using the date and values from cells as the filename to a specific and static location. This is what I have. It appears to work, but I go to the location and there’s no file there. If I change anything at all it tells me that ‘SaveAs failed’.
I’ve tried different pieces of code that I’ve found around the internet.
The code is:
Can anyone see where I’m going wrong? Or is there a different way I can set up the sheet to make this work better?
All help would be greatly appreciated.
I have a sheet that I want to use as a template that is filled in via userform. I cannot for the life of me figure out why the code to save the workbook won't work, so maybe somebody here can help!!
Once the form has been filled in I have a section of code to copy the template sheet into a new workbook. I want the new workbook to Save As using the date and values from cells as the filename to a specific and static location. This is what I have. It appears to work, but I go to the location and there’s no file there. If I change anything at all it tells me that ‘SaveAs failed’.
I’ve tried different pieces of code that I’ve found around the internet.
The code is:
Code:
Sheets("TEMPLATE").Select Sheets("TEMPLATE").Copy
FName = "Filepath is here " & Range("h2").Value & ".xlsm"
ActiveWorkbook.SaveAs fileName:=FName, _
FileFormat:=xlOpenXMLWorkbookMacroEnabled
ActiveWorkbook.Close
Can anyone see where I’m going wrong? Or is there a different way I can set up the sheet to make this work better?
All help would be greatly appreciated.