Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
#14073
Tenho um relatório no excel que estou copiando manualmente em um email template para enviar e queria uma macro que abrisse o email template e buscasse uma String, substituisse pelo relatório e enviasse o email para uma lista pré-definida.

Consegui uma macro que faz parecido com isso , mas quando copia para o email ela não busca a string para substituir ela apenas faz um replace no email template.

Sub SALVA_NO_EMAIL()
Dim mainWB As Workbook
Dim SendID
Dim CCID
Dim Subject
Dim Body

Set otlApp = CreateObject("Outlook.Application")
Set olMail = otlApp.CreateItemFromTemplate("D:\userdata\pmeneses\Desktop\FlashReporttemplate2.msg")
Set Doc = olMail.GetInspector.WordEditor
Set mainWB = ActiveWorkbook

SendID = mainWB.Sheets("Dashboard (3)").Range("p2").Value
CCID = mainWB.Sheets("Dashboard (3)").Range("p2").Value
Subject = mainWB.Sheets("Dashboard (3)").Range("p3").Value
Set Body = mainWB.Sheets("Dashboard (3)").Range("c1:l46")
With olMail
.To = SendID
If CCID <> "" Then
.CC = CCID
End If
.Subject = Subject
Body.Copy


Set wrdRng = Doc.Range
.Display

wrdRng.PasteSpecial Placement:=wdInLine ' , DataType:=wdPasteBitmap
' .Send

End With


'MsgBox ("you Mail has been sent to " & SendID)
End Sub
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord