Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Save file to Specific Directory - then EMAIL

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
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
Excel Email Attachment Save As Root Directory Pete_UK Excel Discussion (Misc queries) 0 March 20th 08 08:02 PM
Save new file in same directory Gert-Jan[_2_] Excel Programming 2 October 19th 06 07:43 PM
Saving file to specific directory sungen99[_75_] Excel Programming 1 February 22nd 06 02:01 PM
Save File to Another Directory, but not change Users File Save location Mike Knight Excel Programming 1 May 28th 04 09:06 PM
get path - save new file - same sub-directory as existing file tegger Excel Programming 2 October 21st 03 10:45 AM


All times are GMT +1. The time now is 11:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"