on ‎2016 May 18 7:16 PM
Hi Experts,
Would appreciate a lot your help with one question. I am working on a template that does the following: 1. Tab A submits data to the system; 2. Tab B is retrieving calculated values from the system. There's a validation built in to compare values between Tab A and Tab B. Thus, I have a macro that saves data to the system from Tab A, then goes to Tab B and refreshes it for validation purposes. However, if data on Tab A has not been changed, the system produces a message "There's no data to save", then Tab B is getting refreshed. I'd like to add a condition to the macro, so that if system produces the message "There's no data to save", the macro would be exited instead of proceeding with Tab B refresh. Is there a way to accomplish this? (I don't know how to capture the system message "There's no data to save" in VBA as a condition to trigger macro exit). Any help would be greatly appreciated!
Request clarification before answering.
Hi Mariya,
Look on AFTER_SAVE event function - it will not trigger if "There's no data to save". Just change some global variable in this function and check this variable in your code. If it's not changed - then "There's no data to save".
Vadim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Like here:
Dim epm As New FPMXLClient.EPMAddInAutomation
Public blnSaved As Boolean
Function AFTER_SAVE()
blnSaved = True
AFTER_SAVE = True
End Function
Public Sub SaveD()
blnSaved = False
epm.SaveAndRefreshWorksheetData
If blnSaved Then
MsgBox "Data was saved"
End If
End Sub
P.S. This code have to be placed in the new module, not in the worksheet module!!! At least - Function AFTER_SAVE()
| User | Count |
|---|---|
| 15 | |
| 11 | |
| 11 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 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.