here is all the code in the form,
Code:Option Explicit Private Sub oCancel_Click() ActiveWorkbook.Saved = True ActiveWorkbook.Close End Sub Private Sub oSend_Click() Application.ScreenUpdating = False Application.DisplayAlerts = False If Me.oComment.Value = "" Then MsgBox ("Please write your comment or cancel"), vbOKOnly, "Missing info" Exit Sub End If Dim oAlexJ As String, oAlexTwo As String oAlexJ = "Pass" oAlexTwo = "word" Workbooks.Open FileName:="c:\\DGF Felixstowe\Employee Opinion Database.xlsx", ReadOnly:=False, Password:=oAlexJ & oAlexTwo, ignorereadonlyrecommended:=True ActiveSheet.Range("A10000").End(xlUp).Offset(1).Select Selection.Value = Me.oComment.Value ActiveCell.Offset(0, 1).Value = Date Workbooks("Employee Opinion Database.xlsx").Save Workbooks("Employee Opinion Database.xlsx").Close Unload Opinion Workbooks("Employee Opinion Send.xlsm").Close Application.ScreenUpdating = True Application.DisplayAlerts = False End Sub Private Sub UserForm_Initialize() Me.BackColor = RGB(255, 192, 0) Me.oSend.BackColor = RGB(255, 192, 0) Me.oSend.ForeColor = RGB(153, 0, 51) Me.oCancel.BackColor = RGB(255, 192, 0) Me.oCancel.ForeColor = RGB(153, 0, 51) End Sub




Reply With Quote

Bookmarks