Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Point to "Contacts" in email 2007

Hello from Steved

I've created a "distribution list" in the "Contacts folder" ( Outlook 2007 )
how can I
please tell the below macro where to look. "Yes below works as it should as
Ive tested it using my name in the "SYSTEM FOLDER".

The reason being is that the company has created a "SYSTEM FOLDER" in which
I cannot use to build a Distribution list.

Sub MailToDepots()
'Working in 97-2007
Dim wb As Workbook
Dim Shname As Variant
Dim Addr As Variant
Dim N As Integer
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
Dim FileFormatNum As Long

Shname = Array("1-City", "1-City", "2-Roskill", "Roskill Tutor",
"3-Papakura", "4-Wiri", "5-Shore", "6-Orewa", "7-Swanson", "8-Panmure")
Addr = Array("steve dee", "1-Depot", "2-Depot", "2-Depot", "4-Depot",
"4-Depot", "5-Depot", "5-Depot", "7-Depot", "1-Depot")


If Val(Application.Version) = 12 Then
'You run Excel 2007
FileExtStr = ".xls": FileFormatNum = 56
Else
'You run Excel 97-2003
FileExtStr = ".xls": FileFormatNum = -4143
End If

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

TempFilePath = Environ$("temp") & "\"

'Create the new workbooks/Mail it/Delete it
For N = LBound(Shname) To UBound(Shname)

TempFileName = "Sheet " & Shname(N) & " " & Format(Now, "dd-mmm-yy
h-mm-ss")

ThisWorkbook.Sheets(Shname(N)).Copy
With ActiveSheet.UsedRange
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
Set wb = ActiveWorkbook

With wb
.SaveAs TempFilePath & TempFileName & FileExtStr, FileFormatNum
On Error Resume Next
.SendMail Addr(N), _
"Driver Annulments"
On Error Resume Next
.Close SaveChanges:=False
End With

Kill TempFilePath & TempFileName & FileExtStr

Next N

With Application
.ScreenUpdating = True
.EnableEvents = True
End With
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
Problems with "Send to email recipient" in Office 2007 cphalen Excel Discussion (Misc queries) 0 May 29th 08 01:20 PM
Display only "new or updated" contacts between two lists Futuremathteacher Excel Discussion (Misc queries) 1 October 11th 07 02:43 AM
How to Link Excel to"Contacts" Folder Bob Levin Excel Discussion (Misc queries) 1 August 28th 07 11:32 AM
Excel 2007 - Email as "Body Text" Alistair Excel Discussion (Misc queries) 4 May 16th 07 05:59 PM
Excel Macro to email to addresses in "Contacts" Tab Appelq Excel Programming 7 August 14th 06 05:51 PM


All times are GMT +1. The time now is 10:29 AM.

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"