TheRedCardinal
Board Regular
- Joined
- Jul 11, 2019
- Messages
- 243
- Office Version
- 365
- 2021
- Platform
- Windows
Hi all,
I have added a prompt for my user to decide if they want to save a file after some processes have been applied to it.
It's a simple message box with a Yes No Option. It worked fine until recently when it started always exiting without opening the Dialog box, even if clicking yes. I stepped through and discovered the Variable was getting a 6 or 7 instead of Yes or No.
So I amended my code:
But it still doesn't work.
As you can see from the screenshot as I walked through, Answer = 6 but the IF statement is still proceeding to the End If Line, even though the logical test should have failed (I pressed yes on the button, and you can see the Variable = 6)
What very obvious thing am I missing?
I have added a prompt for my user to decide if they want to save a file after some processes have been applied to it.
It's a simple message box with a Yes No Option. It worked fine until recently when it started always exiting without opening the Dialog box, even if clicking yes. I stepped through and discovered the Variable was getting a 6 or 7 instead of Yes or No.
So I amended my code:
VBA Code:
Answer = MsgBox("Would you like to save your new VAT submission?", vbYesNo + vbQuestion, "Save Submission")
If Answer = vbNo Or Answer = 7 Then
End If
Else
Application.Dialogs(xlDialogSaveAs).Show
End If
But it still doesn't work.
As you can see from the screenshot as I walked through, Answer = 6 but the IF statement is still proceeding to the End If Line, even though the logical test should have failed (I pressed yes on the button, and you can see the Variable = 6)
What very obvious thing am I missing?