Outlook에 복사하기 전에 Excel 시트의 데이터 서식을 유지하도록 VBA 코드 수정

Outlook에 복사하기 전에 Excel 시트의 데이터 서식을 유지하도록 VBA 코드 수정

Excel 시트의 세부 정보를 Outlook 메일 본문으로 복사하는 VBA가 있습니다. 다음은 매크로입니다.

Sub Send_Email()

Dim EmailSubject As String
Dim SendTo As String
Dim EmailBody As String
Dim ccTo As String

EmailSubject = "Test"
SendTo = "[email protected]"


FirstRow = 1 
LastRow = 5
FirstCol = 1 
LastCol = 2 

For r = FirstRow To LastRow
For c = FirstCol To LastCol

For Each cell In Cells(r, c)
strtable = strtable & "  " & cell.Value
Next
Next
strtable = strtable & vbNewLine
Next

EmailBody = "Hi" & vbLf & vbLf & " body" & vbLf & vbLf & strtable & vbNewLine 

Set App = CreateObject("Outlook.Application")
Set Itm = App.CreateItem(0)
With Itm
.Subject = EmailSubject
.To = SendTo
.CC = ccTo
.Body = EmailBody
.Display
'.Send
End With
Set App = Nothing
Set Itm = Nothing
End Sub

그러나 Excel 시트의 세부 정보는 일부 서식이 포함된 표 형식입니다. 데이터를 Outlook에 복사할 때 테이블과 서식을 유지할 수 있나요? 그렇다면 어떻게요?

관련 정보