Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This should answer many/all questions about automation-emailing with Excel:
http://www.rondebruin.nl/sendmail.htm -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Paul" wrote: If you recorded this as a macro you would not get the \\ at the start of the folder list - could be this is the problem -- If the post is helpful, please consider donating something to an animal charity on my behalf .......... and click Yes "LRay67" wrote: I am not sure what I am doing wrong with the code below. I need to specifically state in the code what network directory (N:) the file is to be saved to. The below for saving to specific directory is not working. Please Help. Thanks Private Sub CommandButton1_Click() 'Working in 2000-2010 'This example send the last saved version of the Activeworkbook Dim MyPath As String Dim fname As Variant Dim Wb As Workbook Set Wb = ActiveWorkbook MyPath = "\\N:\Business Process Engineering\PROJECTS\TEST" 'MyPath = "\\N:\Personnel\Employee Exit Forms - Initial" fname = Application.GetSaveAsFilename(TextBox7.Value & " - Exit Form " & Format$(TextBox1.Value, "mmddyyyy"), _ fileFilter:="Excel Files (*.xls), *.xls") If fname < False Then Wb.SaveAs fname 'Wb.Close False Set Wb = Nothing Else Set Wb = Nothing End If ' ActiveWorkbook.Save Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = "" .CC = "" .BCC = "" .Subject = "Employee Exit Form - Complete within 3 Business Days of Receipt" .Attachments.Add ActiveWorkbook.FullName 'You can add other files also like this '.Attachments.Add '("C:\test.txt") .Display 'or use .Send End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Email Attachment Save As Root Directory | Excel Discussion (Misc queries) | |||
Save new file in same directory | Excel Programming | |||
Saving file to specific directory | Excel Programming | |||
Save File to Another Directory, but not change Users File Save location | Excel Programming | |||
get path - save new file - same sub-directory as existing file | Excel Programming |