Code Stops Executing

  • Thread starter Thread starter gims289
  • Start date Start date
G

gims289

I have code that copies and existing tab into a new spreadsheet then saves
the new spreadsheet. There is code after that that will close the newly
formed spreadsheet and activate the previous spreadsheet. Problem is that
after the code to save the new spreadsheet runs, the code just stops
executing (doesn’t continue to close the new file). Furthermore, the new
spreadsheet doesn’t get save – even though the file name at the top shows
that it was saved. Any help would be appreciated.

'Make a copy of the letter
Sheets("Letter 1").Copy
Sheets("Letter 1").Name = GrpNumber

'Save the workbook – variables have been previously defined
ActiveWorkbook.SaveAs FileName:= _
"G:\Filepath.xls", _
FileFormat:=xlExcel8, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

ActiveWindow.Close

Windows("Previous File.xls").Activate
Sheets("Letter 1").Select
 
Sub CopyShttofile()
grpnumber = "New Name"
Sheets("Letter 1").Copy
ActiveWorkbook.SaveAs Filename:=grpnumber
ActiveWindow.Close
End Sub
 
Back
Top