Code Stops Executing

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
 
D

Don Guillett

Sub CopyShttofile()
grpnumber = "New Name"
Sheets("Letter 1").Copy
ActiveWorkbook.SaveAs Filename:=grpnumber
ActiveWindow.Close
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Save as Read only 2
Conversion from text to excel 2
Code to share a file 3
Save with ref. to cell A1 2
Two digit dates and two digit days 3
Create CSV 3
Macro to save a workbook 1
File SaveAs 1

Top