PC Review


Reply
Thread Tools Rate Thread

Creating Email using Windows XP, Office 2007, Outlook 2007 "worksh

 
 
Steved
Guest
Posts: n/a
 
      20th Jul 2009
Hello from Steved I've copied the below from another computer which worked
fine but now we have upgraded it partly works. What is required please.
The below macro will use the only the bottom three and works like a treat
but it will not email the rest. "1-Depot", has 2 email address and works
along with 2-Roskill, but it will not send Addr = Array "4-Depot" for
speadsheets Shname = Array "3-Papakura","4-Wiri" and Addr = Array 5-Depot for
speadsheets Shname = Array "5-Shore","6-Orewa" and Addr = Array "7-Depot",
for Spreadsheet Shname = Array "7-Swanson", and also Addr = Array 1-City for
Spreadsheet Shname = Array "8-Panmure"

?-Depots each have 2 email address ( Distribution List )

Shname = Array("1-City", "2-Roskill", "2-Roskill"
Addr = Array("1-Depot", "2-Depot", "Roskill Tutor",


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", "2-Roskill", "2-Roskill", "3-Papakura",
"4-Wiri", "5-Shore", "6-Orewa", "7-Swanson", "8-Panmure")
Addr = Array("1-Depot", "2-Depot", "Roskill Tutor", "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

Thankyou.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2007 - Backward "P" char showing when creating email. David from Jax Microsoft Outlook Discussion 11 29th Apr 2009 01:31 PM
With Office 2007, IE & OUTLOOK HANG using "send page by email" Kent V. Busse, J.D. Microsoft Outlook Discussion 2 20th May 2008 11:09 AM
2003 "color theme" file for Outlook 2007 / Office 2007? CraiginNJ Microsoft Outlook 2 21st Sep 2007 05:23 PM
office 2007 "send to email" does not work with outlook express =?Utf-8?B?QXVzbWFydGlu?= Microsoft Word Document Management 0 29th Mar 2007 03:58 AM
OFFICE 2007 ENTERPRISE UG VL (OFFICE-SOLUTION), PROJECT 2007, PUBLISHER 2007, BRITANNICA 2007, other 2006-11-26 new programs CDs 5200 - 5227, and new games CDs 1945 - 1959 kashumoto_tokugawa Windows XP General 0 26th Nov 2006 12:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:44 PM.