VBA To Stop Displaying "Saving File"

jamesmev

Board Regular
Joined
Apr 9, 2015
Messages
233
Office Version
  1. 365
Platform
  1. Windows
I am currently running the below VBA.
Pulls multiple workbooks 2nd sheet and combines them into one. Then saves that "combined" file.
I want this to run as much as "in the background" as possible.

Any Ideas?

******
Sub Auto_Open()
Dim path As String
path = InputBox("Enter a file path", "AUTORUN INPUT")
Filename = Dir(path & "*.xls")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Do While Filename <> ""
Workbooks.Open Filename:=path & Filename, ReadOnly:=True
ActiveWorkbook.Sheets(2).Copy After:=ThisWorkbook.Sheets(1)
Workbooks(Filename).Close
Filename = Dir()


Loop


Call Combine
Call Create_single_file
MsgBox ("Files Merged")
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Sub Combine()
Dim J As Long
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheets(1).Copy Sheets(1)
Sheets(1).Name = "Combined"
For J = 3 To Sheets.Count
Sheets(J).Range("A1").CurrentRegion.Offset(1).Copy
Sheets(1).Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlValues
Next
With Sheets(1).UsedRange
.ColumnWidth = 22
.RowHeight = 18
Application.ScreenUpdating = True
Application.DisplayAlerts = True

End With
End Sub


Sub Create_single_file()
Application.ScreenUpdating = False
Application.DisplayAlerts = False


Dim rs As Worksheet
Dim path As String
Set rs = Worksheets("Combined") 'adjust name as needed
path = InputBox("Enter a file path", "AUTORUN OUTPUT") ' adjust path as needed"
myFile = path & "Downtime.xlsx"


rs.Cells.Copy


Set NewBook = Workbooks.Add
NewBook.Worksheets("Sheet1").Range("A1").Select ' Special (xlPasteValues)(xlPasteformat)
ActiveSheet.Paste


NewBook.SaveAs Filename:=myFile
ActiveWorkbook.Close
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
******
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
You need t turn the statusbar off I think...

Code:
oldStatusBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
Application.StatusBar = ""
 
code 

Application.StatusBar = False
Application.DisplayStatusBar = oldStatusBar

That looks counterintuitive, displaystusbar tells XL to use your statusbar. Setting statusbar = false means control of the statusbar passes back to XL to put what it wants there.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,970
Messages
6,175,703
Members
452,667
Latest member
vanessavalentino83

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