demonllama
New Member
- Joined
- Aug 11, 2017
- Messages
- 2
Im got a macro taking data from one document (stability file) and reformatting it into another document. It uses cells in the stability file to determine what the name should be. If that name is already taken, I want it to pop up a saveas box in the Source Path (stability file location) and allow us to name the file whatever we want. I also want it to save it in .xlsm format which is what im strugging with. Below are a few different ways I have tried to get it to work.
Any help provided would be much help
Code:
ActiveSheet.Name = runStr 'save a copy of the templet using test file name in current directory
wbTarget.Worksheets(1).Range("A1").Select
On Error Resume Next
wbTarget.SaveAs wbSource.Path & "/" & saveAsName & ".xlsm", FileFormat:=52
If Err.Number <> 0 Then
wbTarget.Worksheets(1).Range("A1").Select ' everything before this works correctly
wbTarget.SaveAs wbSource.Path
wbTarget.SaveAs Application.Dialogs(xlDialogSaveAs).Show("*.xlsm")
' Application.Dialogs(xlDialogSaveAs).Show ("*.xls")
' wbTarget.SaveAs Application.GetSaveAsFilename 'This works but requires .xlsm to be typed in each time.
End If
On Error GoTo 0
Any help provided would be much help