Luke Chappel
New Member
- Joined
- Jun 5, 2013
- Messages
- 1
Hi Guys,
Is anyone able to help with my code? I have moved to Office 365 and my email code now changes the subject line to random characters. For example 獹䰥렀绽ঈE折[꛰ˏ&
Currently it is as follows and works well with 2010 and 2013.
Is anyone able to help with my code? I have moved to Office 365 and my email code now changes the subject line to random characters. For example 獹䰥렀绽ঈE折[꛰ˏ&
Currently it is as follows and works well with 2010 and 2013.
Code:
Sub EmailReport()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim Recip()
ReDim Preserve Recip(0)
Recip(0) = "blabla@blabla.com"
ReDim Preserve Recip(1)
Recip(1) = "blablabla@blabla.com"
Dim TempFilePath As String
TempFilePath = Application.DefaultFilePath
'MsgBox "You can find the new file in " & TempFilePath
ActiveWorkbook.SaveCopyAs TempFilePath & "\Phys Pos HardCode " & Format(Date, "dd_mm_yyyy") & ".xlsm"
Workbooks.Open (TempFilePath & "\Phys Pos HardCode " & Format(Date, "dd_mm_yyyy") & ".xlsm")
Sheets.Select
Cells.Select
Selection.Copy
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Controls").Select
ActiveWindow.SelectedSheets.Delete
Sheets("ZSTAT").Select
ActiveWindow.SelectedSheets.Delete
ActiveWorkbook.Save
With ActiveWorkbook
.SendMail Recipients:=Recip, Subject:="Position Report " & Format(Date, "dd/mmm/yyyy")
.Close SaveChanges:=False
End With
Kill TempFilePath & "\Phys Pos HardCode " & Format(Date, "dd_mm_yyyy") & ".xlsm"
Application.Goto Reference:=Sheets("Controls").Range("A1")
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub