![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello from Steved
I've created distribution lists in the Contacts ( Outlook 2007) how can I please tell the below macro where to look. 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 |
Ads |
#2
|
|||
|
|||
![]()
Hello from Steved
I'm posting this to another list Thankyou. "Steved" wrote: Hello from Steved I've created distribution lists in the Contacts ( Outlook 2007) how can I please tell the below macro where to look. 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Set off VBA macro on email receipt then that macro accesses the emailcontent | [email protected] | Outlook and VBA | 3 | February 5th 09 12:14 AM |
Showing more than one email address for multi address contacts | Ralph White | Outlook - Using Contacts | 6 | December 13th 07 01:24 PM |
Inserting contacts email address to send when forwarding email. | NeliRosi | Outlook - General Queries | 3 | August 10th 06 09:54 PM |
Outlook 2002 Uses email address not in Contacts or Address book | Pagen | Outlook - Using Contacts | 1 | February 1st 06 05:11 PM |
Set which local email account can send mail to contacts in address book. (associating an email address with a contact) | Scott Streit | Outlook - General Queries | 3 | January 27th 06 02:57 PM |