Dear Sirs,
I've been desperately debugging the following codes the whole morning, but still cannot find out where the problem lies.
The codes seems can perform each line of the scripts to the end, but all the files in the folder are not saved as intended.
The code is to automatically open each of the *CAL*.xls files, perform some tasks and then save the changes.
Grateful if any could help.
Thanks in advance.
I've been desperately debugging the following codes the whole morning, but still cannot find out where the problem lies.
The codes seems can perform each line of the scripts to the end, but all the files in the folder are not saved as intended.
The code is to automatically open each of the *CAL*.xls files, perform some tasks and then save the changes.
Code:
Sub CAL_File()
'Open each CAL file and format
'
'Ctrl+ L
'
Dim MyFiles As String
Dim CurrentFolder As String
Dim FileName As String
Dim myPath As String
Dim UniqueName As Boolean
UniqueName = False
'Store Information About Excel File
Application.AskToUpdateLinks = False
Application.DisplayAlerts = False
MyFiles = Dir(ActiveWorkbook.Path & "\*CAL*.xl*")
Do While MyFiles <> ""
Workbooks.Open ActiveWorkbook.Path & "\" & MyFiles
Call CALView
Workbooks(2).Activate
ActiveWorkbook.Close SaveChanges = True
On Error GoTo 0
MyFiles = Dir
Loop
Application.AskToUpdateLinks = True
Application.DisplayAlerts = True
Exit Sub
End Sub
Sub CALView()
'
'hotkey : Ctrl + Shft + v
'
Workbooks(2).Activate
ActiveWindow.WindowState = xlNormal
With ActiveWindow
.Top = 294.4
.Left = 1.6
End With
With ActiveWindow
.Width = 1150.8
.Height = 278.4
End With
With ActiveWindow
.Top = -0.2
.Left = -0.8
End With
ActiveWindow.WindowState = xlMaximized
Sheets(Array("CAL-Subcon", "CAL-Supplier", "CAL-IndirectExpense")).Select
ActiveWindow.Zoom = 80
Sheets(Array("CAL-GTT", "CAL-CostCodeList", "Summary")).Select
ActiveWindow.Zoom = 100
Sheets("CAL-GTT").Select
Range("A2").Select
End Sub
Grateful if any could help.
Thanks in advance.