Disabling Save, Save as issues and msgbox issue

Markus_87

New Member
Joined
Mar 29, 2011
Messages
12
Hi guys

I've disabled Save and Save as for my workbook so that people cant tamper with the form, once submitted it will just close and then they can reopen the original if another form needs to be filled out.

However i've noticed with the code i'm using that whenever i open a plain workbook the code still applies and save isn't useable. this might be an issue if the users need the use excel for something else and cant save their document.

this is the code im using

Private Sub Workbook_Open()
disablesaveas
disablesave
End Sub
and this code in Module 1

Sub disblesaveas()
CommandBars("File").Controls("Save As...").Enabled = False
End Sub
Sub disblesave()
CommandBars("File").Controls("Save").Enabled = False
End Sub

thats issue number one, issue number 2 is fairly simple but im being stupid.

I have this code for my msgboxes, I want the final msgbox to close excel without saving once OK has been clicked but it's closing before the msgbox has a chance to appear at the moment

Sub macro1()
If TextBox13.Text = "" Then
MsgBox "Please enter the 'Anaesthetist Name/Initial' field before continuing", vbInformation, "Alert"
Else
If TextBox28.Text = "" Then
MsgBox "Please enter a Date before continuing", vbInformation, "Alert"
Else
If TextBox2.Text = "" Then
MsgBox "Please choose AM or PM before continuing", vbInformation, "Alert"
Else
Range("I32").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:="\\vrbhwebnow\gum2", Collate:=True
Dim Response As String
Dim msg As String
Dim Style As String
msg = "Your form has been submitted"
Style = vbOK
Response = Application.Quit
End If
End If
End If
End Sub
 
Last edited:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,224,567
Messages
6,179,571
Members
452,927
Latest member
whitfieldcraig

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