Problem with E-mailing from Excel

J

John

I'm having a problem E-Mailing a spreadsheet via Code from Excel. The code
itself is fine, but the file is added as an attachment as a "dat" extension.
This has only just started having worked for a long number of months.

I have used VBA Code Cleaner but that has made no difference

I have checked to ensure that the References have been set to "Microsoft
Ooulook 10 library"

My PC is clean of any viruses (AFAIK)

I have using Excel / Outlook XP

Anyone ever have similar problem? Code to E-mail is below (thanks to Ron De
Bruin), but don't think thats the issue, because why would it suddenly cause
a problem?




Sub Mail_Reports()
Dim wb As Workbook
Dim strdate As String
Dim MyArr As Variant
strdate = Format(Now, "dd-mm-yy h-mm")
Application.ScreenUpdating = False
Sheets("E-Figures").Visible = True
Sheets("E-Import").Visible = True
Sheets(Array("E-Figures", "E-Import")).Copy
Set wb = ActiveWorkbook
With wb
.SaveAs ThisWorkbook.Name _
& " Sent on" & " " & strdate & ""
MyArr = Sheets("E-Figures").Range("AJ1:AJ3")
.SendMail MyArr, Sheets("E-Figures").Range("AJ4").Value
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True

Sheets("E-Figures").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("E-Import").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Home").Select
Range("A1").Select
End Sub
 
R

Ron de Bruin

Hi John

Try this


Change this
.SaveAs ThisWorkbook.Name _
& " Sent on" & " " & strdate & ""

To

.SaveAs ThisWorkbook.Name _
& " Sent on" & " " & strdate & ".xls"
 

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