My macro don't insert the E-mail adress when I generate a mail.

Roha1

New Member
Joined
Jul 20, 2017
Messages
15
Hi.

Does anyone know why Excel won't insert anything in the recipient field?

When I use it on my computer it works, but when a collague of mine is trying it it won't.
We are using Excel 2016

Could it be something about acsess?

This code is only part of the whole thing, but everything else are working.
Code:


' Prepare e-mail
.Subject = "Siga Tilbud" & " " & [B13] & " " & WorksheetFunction.Text(Date, "dd.mm.yyyy")
.To = Range("B18") ' <-- Put email of the recipient here
.CC = " " ' <-- Put email of 'copy to' recipient here
.Body = "Hei" & " " & [B12] & "." & vbLf & vbLf _
& "Vedlagt ligger tilbud som avtalt, hvis det er noe spørsmål ta kontakt." & vbLf & vbLf & vbLf & vbLf & "Vennlig hilsen / Best regards" & vbLf & vbLf & [B23] & vbLf & "Produktrådgiver / Instruktør" & vbLf & vbLf & "+47" & " " & [N20]
.Attachments.Add PdfFile
Code:
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi there
Try changing the line

.To = Range("B18") ' <-- Put email of the recipient here

to:
.To = Range("B18").Text ' <-- Put email of the recipient here
 
Upvote 0
How about
Code:
.To = Sheets("[COLOR=#0000ff]Sheet1[/COLOR]").Range("B18")
Changing Sheet name to suit
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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