Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 846
Default Saving a draft only when outlook is open

The macro below will safe a draft when outlook is open, but will not when
outlook is closed. How can I make the change to save a draft - even if
outlook is closed?

This is my poor attempt in creating a Macro - if you see improvements that I
can make please let me know.....


Option Explicit

Sub SendFileToEmail()
Dim objOutlook As Object
Dim objOutlookMsg As Object
Dim strTo As String, strCC As String, strBody As String
Dim iRow As Long, inrec As String
Set objOutlook = CreateObject("Outlook.Application")
' Set objOutlookMsg = objOutlook.CreateItem(0)
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
Dim File1, File2 As String
Dim myCell

iRow = 0
strTo = ""
With shtEmail.Range("EmailToList")
Do
strTo = strTo & .Offset(iRow, 0).Value & ";"
iRow = iRow + 1
Loop Until .Offset(iRow, 0) = ""
End With

' iRow = 0
' strCC = ""
' With shtEmail.Range("CCToList")
' Do
' strCC = strCC & .Offset(iRow, 0).Value & ";"
' iRow = iRow + 1
' Loop Until .Offset(iRow, 0) = ""
' End With

For Each myCell In shtInput.Range("LifeSummary")
strBody = strBody & myCell.Value & vbCrLf
Next


With objOutlookMsg
'.SentonBehalfofName = "
'.To = " 'strTo
.To = strTo
' .Cc = strCC
'.bcc = "
.Subject = "Today's information"
'.BodyFormat = olFormatPlain
.BodyFormat = olFormatHTML
.HTMLBody = "<html<pre" & strBody & "</pre</html"
'.Attachments.Add ("myfilenamewithfullpath.xls")
' .Send 'Let´s go!
.Save ' stick it in drafts
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub

Reply
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
excel open in outlook if outlook is running kirk Excel Discussion (Misc queries) 0 May 24th 06 06:42 PM
excel crashed before saving. Where is draft of file? km Excel Discussion (Misc queries) 1 April 25th 06 10:15 PM
Open Outlook with generic message jamphan Excel Discussion (Misc queries) 0 March 28th 06 03:59 PM
cannot open excel files attached to outlook Ohio Ray Excel Discussion (Misc queries) 1 July 27th 05 01:51 PM
open outlook contact Martin Excel Discussion (Misc queries) 0 May 4th 05 05:48 PM


All times are GMT +1. The time now is 06:38 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"