This is a macro used to send an outlook email out with the a two-tabbed file attached. Randomly stopped working, unsure why. The error quotes, "Automation error, invalid forward reference, or reference to uncompiled type."
Any suggestions would be helpful!
Code:
Sub GenerateFuelInventoryReport()
'
' GenerateFuelInventoryReport Macro
' Macro recorded 11/20/2006 by cliggio
' ' CurrentBook = ActiveWorkbook.Name
Sheets(Array("Narrows", "Monthly Accounting")).Select
Sheets("Narrows").Activate Sheets(Array("Narrows", "Monthly Accounting")).Copy
TempBook = ActiveWorkbook.Name
Cells.Select Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False
ActiveSheet.Next.Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False
'ActiveSheet.Next.Select
'Cells.Select
'Application.CutCopyMode = False
'Selection.Copy
'Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ ' :=False, Transpose:=False
Rows("1:3").Select
Range("A3").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Sheets("Narrows").Select
Rows("1:3").Select
Range("A3").Activate
Selection.Delete Shift:=xlUp
'Sheets("Astoria").Select
'Rows("1:3").Select
'Range("A3").Activate
'Selection.Delete Shift:=xlUp
fuelreportname = Range("fuelreportname").Value
Range("B1").Select '
ActiveSheet.Shapes("CommandButton1").Select '
Selection.Delete
Windows(CurrentBook).Activate
Sheets("Oil - GT").Select
Windows(TempBook).Activate
ChDir "L:\Commercial Ops\NYISO\Fuel Ops\Fuel Forecasts\22-02"
ActiveWorkbook.SaveAs Filename:=("L:\Commercial Ops\NYISO\Fuel Ops\Fuel Forecasts\22-02\" & fuelreportname)
Application.Dialogs(xlDialogSendMail).Show arg1:="AstoriaFuelConsumptionReport"
End Sub
Any suggestions would be helpful!
Code:
Sub GenerateFuelInventoryReport()
'
' GenerateFuelInventoryReport Macro
' Macro recorded 11/20/2006 by cliggio
' ' CurrentBook = ActiveWorkbook.Name
Sheets(Array("Narrows", "Monthly Accounting")).Select
Sheets("Narrows").Activate Sheets(Array("Narrows", "Monthly Accounting")).Copy
TempBook = ActiveWorkbook.Name
Cells.Select Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False
ActiveSheet.Next.Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False
'ActiveSheet.Next.Select
'Cells.Select
'Application.CutCopyMode = False
'Selection.Copy
'Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ ' :=False, Transpose:=False
Rows("1:3").Select
Range("A3").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Sheets("Narrows").Select
Rows("1:3").Select
Range("A3").Activate
Selection.Delete Shift:=xlUp
'Sheets("Astoria").Select
'Rows("1:3").Select
'Range("A3").Activate
'Selection.Delete Shift:=xlUp
fuelreportname = Range("fuelreportname").Value
Range("B1").Select '
ActiveSheet.Shapes("CommandButton1").Select '
Selection.Delete
Windows(CurrentBook).Activate
Sheets("Oil - GT").Select
Windows(TempBook).Activate
ChDir "L:\Commercial Ops\NYISO\Fuel Ops\Fuel Forecasts\22-02"
ActiveWorkbook.SaveAs Filename:=("L:\Commercial Ops\NYISO\Fuel Ops\Fuel Forecasts\22-02\" & fuelreportname)
Application.Dialogs(xlDialogSendMail).Show arg1:="AstoriaFuelConsumptionReport"
End Sub