LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Excel Macro to Copy Word Text into an Email

Hello,

What I'm trying to do is set up a macro that will copy text from a
word doc into the body of my email (the reason a word doc is so I can
keep the formatting). Here is what I have so far:

Sub SendEmail()
Dim OutlookApp As Object
Dim MItem As Object
Dim cell As Range
Dim email As String
Dim cc As String
Dim subject As String
Dim body As String
Dim attach As String
Dim I As Long
'Create Outlook object
Set OutlookApp = CreateObject("Outlook.Application")

' Loop through the rows
For Each cell In
Range("b2:b100").Cells.SpecialCells(xlCellTypeCons tants)

email = cell.Value
subject = cell.Offset(0, 2).Value
body = cell.Offset(0, 3).Value
cc = cell.Offset(0, 1).Value
attach = cell.Offset(0, 4).Value

'Create Mail Item and send it
Set MItem = OutlookApp.CreateItem(0)
With MItem
.To = email
.cc = cc
.subject = subject
.body = body
.Attachments.Add "C:\temp\test.xls"
.Attachments.Add "C:\temp\test2.xls"
.display
End With
Next
End Sub


Right now the body is just being pulled from a cell in my excel file,
but the cell doesn't hold all the formatting I need. If anyone can
help me out here that would be great, or if you even have a better
idea on how to simply add the text that's cool too.

Thanks,

Tyson

(Sorry if this is a double post - I got an error page the last time I
hit Post)

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I copy several lines of word text into one excel cell? jhh New Users to Excel 2 June 16th 06 11:18 PM
Copy text from Excel to Word mayanklal Excel Programming 1 June 8th 06 11:21 PM
Copy text from excel and paste in word - Urgent Help sippy Excel Programming 0 June 4th 06 09:51 PM
how do i find an email and copy the text and paste into excel sheet VB Script for Excel Excel Programming 2 April 29th 06 06:38 PM
How do I copy a Word text file into Excel in a way that each char. Newtech programmer Excel Discussion (Misc queries) 2 April 15th 05 07:07 PM


All times are GMT +1. The time now is 04:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"