Forum Discussion
AOSPWB
Aug 06, 2026Brass Contributor
VBA Code stops
Not sure what is going on... this was working and now all the sudden the code stops part way through.
Here is the current code (linked to a button)
Private Sub CommandButton2_Click()
Dim cofCom As Object
Set cofCom = Application.COMAddIns("SapExcelAddIn").Object
Dim api As Object
Set api = cofCom.GetPlugin("com.sap.epm.FPMXLClient")
api.RefreshActiveWorkbook
Application.ScreenUpdating = False
ActiveWorkbook.Sheets("Spend Detail").Activate
Sheet14.CommandButton2_Click
Sheet14.CommandButton1_Click
ActiveWorkbook.Sheets("Spend Detail 1").Activate
Sheet21.CommandButton4_Click
Sheet21.CommandButton3_Click
ActiveWorkbook.Sheets("Spend Detail 2").Activate
Sheet22.CommandButton6_Click
Sheet22.CommandButton5_Click
ActiveWorkbook.Sheets("Spend Detail 3").Activate
Sheet23.CommandButton8_Click
Sheet23.CommandButton7_Click
ActiveWorkbook.Sheets("Spend Detail 4").Activate
Sheet24.CommandButton10_Click
Sheet24.CommandButton9_Click
ActiveWorkbook.Sheets("Spend Detail 5").Activate
Sheet25.CommandButton12_Click
Sheet25.CommandButton11_Click
ActiveWorkbook.Sheets("Spend Detail 6").Activate
Sheet27.CommandButton14_Click
Sheet27.CommandButton13_Click
ActiveWorkbook.Sheets("Finance Input Sheet").Activate
Application.ScreenUpdating = True
End SubThe problem is that all tabs update for the refresh but for some reason, going to each sheet and clicking the buttons is not occurring now. It is essentially stopping at line 6 and I have tried removing the screenupdating false and true and that did not make any difference. Just like for some reason the code stops and it was working a week ago.
Any suggestions?