OK guys,
Here is the code that is ran from the Notice sheet, from a button. This code just checks for mandatory data, then calls the user form, code as above. I have used a userform so that I can display a message on screen while the code is executing. My users were seeing the hourglass and thinking the machine had crashed. All my user form has is the company logo, and a message "Saving - Please Wait" in the title bar.
How do I pass the required variables into the userform_activate and FUBARVBA code. Have in mind that the FUBARVBA module is called from lots of different places.
Thanks again,
Bob
Private Sub btnsave_Click()
Dim liAnswer As Integer, wsData As Worksheet
Dim strArray(0 To 4, 0 To 1) As String, lDim1 As Long
ActiveSheet.Range("A7").Activate
Const strWbkName As String = "Bluestone Project Workbook"
Const strPwd As String = "florence"
'User confirmation
liAnswer = MsgBox("Have you finished with this Notice?", vbYesNo, strWbkName)
If liAnswer = vbNo Then
MsgBox "Notice Not Saved", vbCritical, strWbkName
Exit Sub
End If
'Check for mandatory data
Set wsData = ThisWorkbook.Worksheets("notice")
strArray(0, 0) = "B4"
strArray(0, 1) = "Please select who the notice is issued to !"
strArray(1, 0) = "B5"
strArray(1, 1) = "Please enter a subject !"
strArray(2, 0) = "G4"
strArray(2, 1) = "Please enter a date !"
strArray(3, 0) = "A27"
strArray(3, 1) = "Please enter a response date !"
strArray(4, 0) = "E27"
strArray(4, 1) = "Please select who is issuing this Notice !"
For lDim1 = 0 To 4
With wsData.Range(strArray(lDim1, 0))
If .Value = "" Then
wsData.Unprotect PASSWORD:=strPwd
.Activate
.Interior.ColorIndex = 3
MsgBox strArray(lDim1, 1), vbCritical, strWbkName
.Interior.ColorIndex = 0
wsData.Protect PASSWORD:=strPwd
Exit Sub
End If
End With
Next lDim1
'Check for e-mail module
If Sheets("email").Range("J26") = 0 Then
If Sheets("directory").Range("L19") Then
MsgBox "There are no e-mail settings for Notice" & vbNewLine & _
"Please set-up email and re-try", vbOKOnly, strWbkName
Sheets("email").Activate
Exit Sub
End If
End If
frmsavenotice.Show
End Sub