I have a file with 2 buttons, one to "Show questionnaire" and one to "Show Answers""Show questionnaire" shows a questionnaire with questions for people to answer "Show Answers" shows the answers to each question
At the moment when the file is first opened the "Show Answers" button is hidden
Then when someone finishes the questionnaire and submits their answers the following code should run
Worksheets("Questionnaire").Activate
ActiveSheet.Buttons("Button 3").Visible = True
ActiveWorkbook.SaveAs Filename:="Folder where a copy of the questionnaire with the answers is saved") & ".xlsb", FileFormat:=xlExcel12, Password:="123", CreateBackup:=False
Worksheets("Questionnare").Activate
ActiveSheet.Buttons("Button 3").Visible = False
MsgBox "Thank you for your submission", vbOKOnly
ActiveWorkbook.Close
This code makes the button visible, then creates a copy and saves it into a folder with a password (so the button is available only in that new file for people who have the password to the file) and then makes the button non visible in the original file so when a new person tries to answer the questionnaire the "Show Answers" button does not appear for them.
My issue is that at the moment what the code actually does is it makes the button visible, saves the file, opens the new file and then makes the button non visible in the new file rather than in the original file.
How can I stop the "SaveAS" option from opening the new workbook after it saves it? how can I make it make the "Show Answers" button non visible in the original file instead?