on 03-05-2019 7:49 AM
Hi All,
We are using AFO Version 2.4 to execute BPC Input Forms.
In the Form we have used buttons with VBA Macros.
My macro code is as follows:
Public Sub Save()
Dim lResult As String
Dim i As Integer
If MsgBox("Do you want to Save the Work Status changes?", vbYesNo, "Selection") = vbNo Then
Exit Sub
Else:
Range("F1").value = " "
lResult = Application.Run("SAPExecutePlanningSequence", "PS_1")
If Range("F1").value = "X" Then
IResult = Application.Run("SAPExecuteCommand", "PlanDataSave")
ElseIf Range("F1").value = "Y" Then
lResult = Application.Run("SAPExecuteCommand", "PlanDataReset")
MsgBox ("Central Admin Lock preventing SFIN & CCM Work Status changes.")
End If
End If
End Sub
Sometimes this code runs without issues.
On certain occasions it gives the message 'Only comments are allowed after end Sub' and goes into debug mode. I have checked that there are no blank lines in the code after End Sub.
On other occasions it goes into restart mode.
Please let me know why this may be happening or if you have experienced the same.
Excel and Analysis for Office that I am using are from within Citrix.
Thanks in Advance
Amrita
In general I can recommend using full object declaration:
Not:
Range("F1").value
But:
Thisworkbook.Worksheets("SheetName").Range("F1").Value
P.S. It's better to use code button to post code - will be readable!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.