Code for Command Button - error message when other button not yet clicked

Nadine1988

Board Regular
Joined
Jun 12, 2023
Messages
62
Office Version
  1. 365
Platform
  1. Windows
Hello,

i do have a file with two command buttons.
Command Button 1 does check some fields and then save the file.
Command button 2 does send the saved file attached to an email.

I would now need a code that doesn't allow command button 2 to be pressed if the file wasn't saved (so if command button 1 wasn't pressed yet)
So the user has to save the file BEFORE submitting the form.

any ideas on how to set this up correctly? Thanks!
Nadine
 
As you can see in the screenshot it's supposed to be a quote number / subject line - filled out by the sales team. i know it was A15 before but i did change the layout a little bit.
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
As you can see in the screenshot it's supposed to be a quote number / subject line - filled out by the sales team. i know it was A15 before but i did change the layout a little bit.
So what value is your code using for the file name and where does this value come from?

Can you give me a file name example?
 
Upvote 0
For testing i'm only using "Test" but it can be literally everything - most probably a mix out of numbers and letters
So what value is your code using for the file name and where does this value come from?

Can you give me a file name example?f
 
Upvote 0
For testing i'm only using "Test" but it can be literally everything - most probably a mix out of numbers and letters
In a previous post you said:
The filename is supposed to come for cell A18 - but with your code it's not saving at all. and with my code it's saving with the wrong name.

Where is the data coming from that is making up the file name that you say is the wrong name?
 
Upvote 0
i found out what was wrong. i did change the file format but not in the whole code. it's working now.

so just one more error to fix and then I'm finally finished! THANK YOU ALL FOR YOUR SUPPORT!
 
Upvote 0
Just in case you wanna look into this too:

"Hello - i actually run into an other error with this.

so this is the code:

VBA Code:
Sub Optionsfeld38_BeiKlick()
Sheet1.Unprotect Password:="Vizrt"

If Optionsfeld38 = False Then
Rows("15:16").EntireRow.Hidden = Not Rows("15:16").EntireRow.Hidden
End If

Sheet1.Protect Password:="Vizrt"

End Sub
Sub Optionsfeld39_BeiKlick()
Sheet1.Unprotect Password:="Vizrt"

Rows("15:16").EntireRow.Hidden = False

Sheet1.Protect Password:="Vizrt"
End Sub

So it actually hides the rows when clicking the "No" optionbutton but the problem with this is that rows 15:16 all of a sudden appear as soon as i move forward with entering data into the rest of the form. any ideas what's wrong here?

Thank you!"
 
Upvote 0

Forum statistics

Threads
1,215,097
Messages
6,123,079
Members
449,094
Latest member
mystic19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top