Email macro

K

Kevin

can anyone find the flaw??

here's my macro and here's the issue. I've tested this with three
computers, two work and one does not, i get a Run-time error 1004.

Run-time error'1004':
Microsoft Office Excel cannot access teh file 'N:'. There are several
possible reasons:

The file name or path does not exist
The file name is being used by another program.
the workbook you are tryig to save has the same name as a currently open
workbook.



Calculate
Dim OutApp As Object
Dim OutMail As Object
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "yyyy-mm-dd")
Application.ScreenUpdating = False
Sheets("Emailed").Visible = True
Sheets("Emailed").Select
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs ThisWorkbook.Name & " " & strdate & ".xls"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(o)
With OutMail
.To = "(e-mail address removed)"
.CC = ""
.BCC = ""
.Subject = "New Accounts Activity"
.Body = "Please do a 'Paste Special' and choose 'Values and
Number Formats'"
.Attachments.Add wb.FullName
.Display
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
Sheets("Emailed").Select
ActiveWindow.SelectedSheets.Visible = False
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top