SaveAs Stalling in the Saving dialog

breynolds0431

Active Member
Joined
Feb 15, 2013
Messages
303
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I've seen this issue on some other posts/sites, but nothing that ever looked to be resolved. Basically, I have a file that need to copy certain tabs to a pre-existing workbook (now that I think about it, this could be a new workbook), then saves the file with the same filename plus the save date appended to the end of the file name. The issue is that when it gets to the save-as step, the "saving" dialog displays and makes some progress but doesn't close on it's own. I need to manually click the "Cancel" button for the dialog to close. Then, the macro starts back up on it's own - also weird.

Below is the code I'm attempting. Any help would be greatly appreciated...

VBA Code:
Sub SheetMove()

Application.StatusBar = "Moving Sheets . . . "

Dim ws As Worksheet
Dim wst As Worksheet

Application.ScreenUpdating = False
Application.DisplayAlerts = False


Workbooks.Open ("\\[LAN location]\[filename1].xlsx")

Workbooks.Open ("\\[LAN location]\[filename1].xlsx")

For Each ws In ThisWorkbook.Worksheets

    Select Case ws.Name
        Case "Tab1-w", "Tab2-w", "Tab3-w", "Tab4-w", "Tab5-w"
        Case Else
        
            With Workbooks("[file2name].xlsx")
                ws.copy After:=.Sheets(.Sheets.Count)
            End With
        End Select
    Next

For Each wst In ThisWorkbook.Worksheets

    Select Case wst.Name
        Case "Tab1-x", "Tab2-x", "Tab3-x", "Tab4-x", "Tab5-x"
        Case Else
        
            With Workbooks("[file1name].xlsx")
                wst.copy After:=.Sheets(.Sheets.Count)
            End With
        End Select
    Next

Windows("[file1name].xlsx").Activate
    
    ActiveWorkbook.SaveAs Filename:="\\[LAN location]\[filename1] - " _
        & Format(Date, "yyyymmdd") & ".xlsx", FileFormat:=51, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
       False, CreateBackup:=False
    
   Windows("[file1name].xlsx").Activate
    ActiveWorkbook.Close SaveChanges:=False
      
If Application.Dialogs(xlDialogSaveAs).Show Then

Else

End If

   Windows("[file1name].xlsx").Activate
    ActiveWorkbook.Close SaveChanges:=False
    
Windows("[file2name].xlsx").Activate
    
    ActiveWorkbook.SaveAs Filename:="\\[LAN location]\[filename2] - " _
        & Format(Date, "yyyymmdd") & ".xlsx", FileFormat:=51, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
       False, CreateBackup:=False
   Windows("[file2name].xlsx").Activate
    ActiveWorkbook.Close SaveChanges:=False

If Application.Dialogs(xlDialogSaveAs).Show Then

Else

End If
 
   Windows("[file2name].xlsx").Activate
    ActiveWorkbook.Close SaveChanges:=False
    

Application.ScreenUpdating = True
Application.DisplayAlerts = True

Application.StatusBar = ""
    
MsgBox "Good news! The *** Workbooks have been updated and saved to their respective folders on the LAN."
    
End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,223,763
Messages
6,174,359
Members
452,558
Latest member
jswan83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top