annadinesh
Board Regular
- Joined
- Mar 1, 2017
- Messages
- 123
- Office Version
- 2019
- Platform
- Windows
Dear Expert
Please help
in the below VBA Code I want the following to be input after the image copies to Email Body
"Regards
Dinesh Saha
Durga Hyundai
and the Text cursur should be on the Top of Image
Private Sub CommandButton2_Click()
If ActiveSheet.Name = "EW" Then
If IsEmpty(Worksheets("EW").Range("Y1")) Then
Cancel = True
MsgBox ("Email ID Blank"), vbDefaultButton1, "E Mail"
Else
If IsEmpty(Worksheets("EW").Range("D5")) Then
Cancel = True
MsgBox ("Please Select Vehicle Model"), vbDefaultButton1, "Vehicle Model Blank"
Range("D5").Activate
Else
Dim Outlook As Object
Dim email As Object
Dim xInspect As Object
Dim pageEditor As Object
Dim assunto As String, para As String
Dim myRange As Excel.Range
Set Outlook = CreateObject("Outlook.application")
Set email = Outlook.CreateItem(0)
With email
.Subject = "Hyundai Extended Warranty & RSA Quotation"
.To = Range("Y1").Value
.Display
Set xInspect = email.GetInspector
Set pageEditor = xInspect.WordEditor
pageEditor.Range.Characters(1).Select
With pageEditor.Application.Selection
.Collapse 1 ' 1 = wdCollapseStart
.InsertAfter "Dear Hyundai Customer," & vbCrLf & vbCrLf & _
"here's the info:" & vbCrLf & vbCrLf
.Collapse 0 ' 0 = wdCollapseEnd
For Each myRange In Sheets("EW") _
.Range("B2:K47").Areas
myRange.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
'.PasteAndFormat Type:=13 ' 13 = wdChartPicture
.PasteSpecial DataType:=4 ' 4 = wdPasteBitmap
.Collapse 0
Next myRange
End With
.Display
Set pageEditor = Nothing
Set xInspect = Nothing
End With
Set email = Nothing
Set Outlook = Nothing
End If
End If
End If
End Sub
Please help
in the below VBA Code I want the following to be input after the image copies to Email Body
"Regards
Dinesh Saha
Durga Hyundai
and the Text cursur should be on the Top of Image
Private Sub CommandButton2_Click()
If ActiveSheet.Name = "EW" Then
If IsEmpty(Worksheets("EW").Range("Y1")) Then
Cancel = True
MsgBox ("Email ID Blank"), vbDefaultButton1, "E Mail"
Else
If IsEmpty(Worksheets("EW").Range("D5")) Then
Cancel = True
MsgBox ("Please Select Vehicle Model"), vbDefaultButton1, "Vehicle Model Blank"
Range("D5").Activate
Else
Dim Outlook As Object
Dim email As Object
Dim xInspect As Object
Dim pageEditor As Object
Dim assunto As String, para As String
Dim myRange As Excel.Range
Set Outlook = CreateObject("Outlook.application")
Set email = Outlook.CreateItem(0)
With email
.Subject = "Hyundai Extended Warranty & RSA Quotation"
.To = Range("Y1").Value
.Display
Set xInspect = email.GetInspector
Set pageEditor = xInspect.WordEditor
pageEditor.Range.Characters(1).Select
With pageEditor.Application.Selection
.Collapse 1 ' 1 = wdCollapseStart
.InsertAfter "Dear Hyundai Customer," & vbCrLf & vbCrLf & _
"here's the info:" & vbCrLf & vbCrLf
.Collapse 0 ' 0 = wdCollapseEnd
For Each myRange In Sheets("EW") _
.Range("B2:K47").Areas
myRange.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
'.PasteAndFormat Type:=13 ' 13 = wdChartPicture
.PasteSpecial DataType:=4 ' 4 = wdPasteBitmap
.Collapse 0
Next myRange
End With
.Display
Set pageEditor = Nothing
Set xInspect = Nothing
End With
Set email = Nothing
Set Outlook = Nothing
End If
End If
End If
End Sub