Highlight cells to edit but do not print in color en not send before cells are filled

STEEL010

Board Regular
Joined
Dec 29, 2017
Messages
76
Hello all,

I have question I want to highlight cells to edit but not print in color en not send by email before cells are filled.
I do not want to us black and white in the printing setup, because some features on the sheet must be printed in color.

Hope somebody can help

Thanks
Steel010
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I have wrote the following code in VBA.
note: forget the button :-)

the code works half its checking when the fields are filled then it will not go end send the email???
please help me on this

Sub SendWorkBook()
'Update 20171227
Dim xFile As String
Dim xFormat As Long
Dim Wb As Workbook
Dim Wb2 As Workbook
Dim FilePath As String
Dim FileName As String
Dim rng As Range
Dim cel As Range
Dim iBlank As Integer
Dim OutLookApp As Object
Dim OutlookMail As Object
On Error Resume Next

'check cells before sending
Set rng = SheetNL.Range("B5,B6,B11,C16,D42,H6,H8,H9,J18")

For Each cel In rng
If cel.Value = "" Then iBlank = iBlank + 1
Next cel
If iBlank > 0 Then 'something is blank
Call MsgBox("Please complete all red fields before sending.", vbOKOnly + vbCritical, "Missing Info")
Else



Application.ScreenUpdating = False
Set Wb = Application.ActiveWorkbook
ActiveBook.Copy
Set Wb2 = Application.ActiveWorkbook
Select Case Wb.FileFormat
Case xlOpenXMLWorkbook:
xFile = ".xlsx"
xFormat = xlOpenXMLWorkbook
Case xlOpenXMLWorkbookMacroEnabled:
If Wb2.HasVBProject Then
xFile = ".xlsm"
xFormat = xlOpenXMLWorkbookMacroEnabled
Else
xFile = ".xlsx"
xFormat = xlOpenXMLWorkbook
End If
Case Excel8:
xFile = ".xls"
xFormat = Excel8
Case xlExcel12:
xFile = ".xlsb"
xFormat = xlExcel12
End Select
FilePath = Environ$("temp") & ""
FileName = Wb.Name & Format(Now, "dd-mmm-yy h-mm-ss")
Set OutLookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutLookApp.CreateItem(0)
Wb2.SaveAs FilePath & FileName & xFile, FileFormat:=xFormat
With OutlookMail
.To = "test@test.com"
.CC = ""
.BCC = ""
.Subject = "test"
.Body = "test"
.Attachments.Add Wb2.FullName
.Send
'Display
End With
On Error GoTo 0
Wb2.Close
Kill FilePath & FileName & xFile
Set OutlookMail = Nothing
Set OutLookApp = Nothing
Application.ScreenUpdating = True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,248
Members
452,623
Latest member
cliftonhandyman

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