I have this code that sends a range as a picture into an outlook email. I added checkboxes and want to be able to modify the code to send the contents in range B4:B17 and one or all of C,D, and E depending on if the checkbox is true.
I have no idea how to do this, can anyone help me?
I have no idea how to do this, can anyone help me?
VBA Code:
Sub Screen2ShotMain()
Dim rng As Range
Dim olApp As Object
Dim Email As Object
Dim wdDoc As Word.Document
Dim wdRng As Word.Range
Rows("11:11").Select
Selection.EntireRow.Hidden = True
Set rng = Sheets("Calc").Range("B4:C16")
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set olApp = CreateObject("Outlook.Application")
Set Email = olApp.CreateItem(0)
With Email
'.To = "damor"
.CC = ""
.BCC = ""
.Subject = "Forward Commitment" ' & Range("F5").Value
.Body = "Please see details of forward commitment as discussed" & vbCr & vbCr
.Display
DoEvents
Set wdDoc = Email.GetInspector.WordEditor
Set wdRng = wdDoc.Application.ActiveDocument.Content
wdRng.Collapse Direction:=wdCollapseEnd
rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture
wdRng.PasteSpecial DataType:=3
.Display
End With
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set Email = Nothing
Set olApp = Nothing
Rows("11:11").Select
Selection.EntireRow.Hidden = False
ActiveSheet.Protect Password:="Mortgage1"
End Sub