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
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: