• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

format body of message that will send with vb

hoomantt

Member
Hi Dear Friends,
I have a vb that will send active workbook such an attachment with outlook.
that is it :
----------------------------------------------------------------------------------
Sub EmailFile()
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.TO = "hooman@mahyadarou.com;ali@mahyadarou.com;hoda@mahyadarou.com"
.CC = ""
.BCC = ""
.Subject = "صورت جلسه اقلام انقضا نزديک"
.Body = "xxxxxxx"
.Attachments.Add ActiveWorkbook.FullName
.Display
End With
On Error GoTo 0
End Sub
----------------------------------------------------------------------------------
In this Code
1-how i can connect (To) of this code to a column(for ex. F)in the Sheet(for Ex. Menu) ?
i want send this email to 30 persons and whit this code i should write the name of these persons in TO such as above(hooman & Ali & Hoda & ...)
i have the address of these people in a column and want to read them from column(F) in sheet(menu)
2- i want to write and format the body of message such as bellow.what should i do?
how can write it?
i want to BOLD some sentences,
i want to Align left or write or middle some sentences,
i want to font color(Blue) to a sentence,
i want to insert Enter between sentences,
and ..... such as bellow
به نام خدا

" برای پیشرفت و موفقیت، نیاز مطلق به اهداف روشن و از پیش تعیین شده، خواهیم داشت."


مدیر محترم برنامه ریزی تأمین کالا و کنترل فروش
جناب آقای ظهیری
سلام علیکم
احتراماً باستحضار میرساند





با احترام
هومن تهرانی
کارشناس فروش
شرکت محیادارو(سهامی خاص)وابسته به شرکت بازرگانی و سرمایه گذاری فرزاد نام
تهران، سید خندان-ابتدای بزرگراه رسالت- خ دبستان-کوچه حیامنش-پلاک 56
تلفن: 88468008 (9821+)، داخلی: 199
فاکس: 88465315 (9821+)

کدپستی: 1631644561
 
Hi

1. The syntax you have seems ok. If you want to string names together from a range then you can use, e.g (untested):

Code:
Dim lngItem as Long
Dim lngItems as Long
Dim varTo as Variant
Dim strTo as String

lngItems=Range("A1:A10").Rows.Count
Redim varTo (1 to lngItems)
For lngItem = 1 to lngItems
    varTo(lngItem)=Range("A1:A10")(lngItem).Value
next lngItem
strTo = Join$(varTo,";")

2. You need to use the HTMLBody property. This means you need to write the formating as HTML. See here.
 
Back
Top