The problem line within the code is this part:
Expand|Select|Wrap|Line Numbers
- Windows("rollifrp.xls").Activate
- Columns("A:L").Select
- Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
- OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
- If AP.Value < 10 Then
- stDocName = "Q:\Reports\Financial Reporting\IFRS\" & CurrYr & "\AP0" & AP.Value & "\04_Models\rollifrp AP0" & AP.Value & ".xls"
- Else
- stDocName = "Q:\Reports\Financial Reporting\IFRS\" & CurrYr & "\AP" & AP.Value & "\04_Models\rollifrp AP" & AP.Value & ".xls"
- End If
- Windows("rollifrp.xls").Activate
- Range("A1").Select
- ActiveWorkbook.SaveAs stDocName ******ERRORS HERE SAYING DOCUMENT NOT SAVED******
- ActiveWorkbook.Close
- The full code for the macro is below:
- Sub FXcurr()
- '
- ' FXcurr Macro
- ' Macro recorded 19/04/2006 by u415264
- '
- ' Open Quantum download report
- Application.ScreenUpdating = False
- Dim stDocName As String
- Dim AP As Range
- Dim CurrYr As Range
- Application.ScreenUpdating = False
- Set AP = Worksheets("Index").Range("E4")
- Set CurrYr = Worksheets("Index").Range("E6")
- ' rollifrp excel details only
- stDocName = "Q:\Reports\Financial Reporting\IFRS\Models\rollifrp.xls"
- Workbooks.Open stDocName
- Windows("rollifrp.xls").Activate
- Cells.Select
- With Selection
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .ShrinkToFit = False
- .MergeCells = False
- End With
- Rows("1:10").Select
- Selection.Delete shift:=xlToUp
- Columns("F:F").Select
- Selection.Delete shift:=xlToLeft
- Columns("G:G").Select
- Selection.Delete shift:=xlToLeft
- Columns("H:H").Select
- Selection.Delete shift:=xlToLeft
- Columns("L:L").Select
- Selection.Delete shift:=xlToLeft
- Range("B2").Select
- Selection.Cut
- Range("B1").Select
- ActiveSheet.Paste
- Range("G1").Select
- Selection.Cut
- Range("H1").Select
- ActiveSheet.Paste
- Range("B1").Select
- Selection.Copy
- Range("I1").Select
- ActiveSheet.Paste
- Range("I2:J2").Select
- Selection.Cut
- Range("J1").Select
- ActiveSheet.Paste
- Range("K2").Select
- Selection.Cut
- Range("L1").Select
- ActiveSheet.Paste
- Range("L2").Select
- Selection.Cut
- Range("M1").Select
- ActiveSheet.Paste
- Rows("2:4").Select
- Selection.Delete shift:=xlToUp
- ' ActiveSheet.Shapes("Picture -767").Select
- ' Selection.Cut
- ' Copy data to master file
- Cells.Select
- Selection.Copy
- Windows("MASTER - FX Reconciliations Modelvista.xls").Activate
- Sheets("rollifrp").Select
- ActiveSheet.Paste
- ' Reformat original file for saving in AP folders
- Windows("rollifrp.xls").Activate
- Columns("A:L").Select
- Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
- OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
- If AP.Value < 10 Then
- stDocName = "Q:\Reports\Financial Reporting\IFRS\" & CurrYr & "\AP0" & AP.Value & "\04_Models\rollifrp AP0" & AP.Value & ".xls"
- Else
- stDocName = "Q:\Reports\Financial Reporting\IFRS\" & CurrYr & "\AP" & AP.Value & "\04_Models\rollifrp AP" & AP.Value & ".xls"
- End If
- Windows("rollifrp.xls").Activate
- Range("A1").Select
- ActiveWorkbook.SaveAs stDocName ******ERRORS HERE SAYING DOCUMENT NOT SAVED******
- ActiveWorkbook.Close