Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 26th, 2006, 06:30 AM
Registered User
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default E-Mail Attachments

How do I set up a macro that will attach a workbook to an e-mail without sending it automatticly

I use the following to send e-mail auto for me;

Sub EMail_Workbook_SCM()


If MsgBox("Click OK to send report", vbOKCancel, _
    "You are about to send this report to Supply Class Management") = vbCancel Then Exit Sub



    Dim wb1 As Workbook
    Dim wb2 As Workbook
    Dim wbname As String
    ActiveWorkbook.Save
    Application.ScreenUpdating = False
    Set wb1 = ActiveWorkbook
    wbname = "C:/" & wb1.Name & " " & _
    Format(Now, "dd-mm-yy") & ".xls"
    wb1.SaveCopyAs Filename:=wbname
    Set wb2 = Workbooks.Open(wbname)
    With wb2
        .SendMail "[email protected]"
        .ChangeFileAccess xlReadOnly
        Kill .FullName
        .Close False
    End With
    Application.ScreenUpdating = True
End Sub









Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
Mail with Attachments software_developer_kk Classic ASP Basics 1 March 31st, 2005 12:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.