Solved: E-Mail/Command Buttons
All,
I want to copy a sheet tab and send it off in an e-mail with the working command buttons - (They do sorting).
The macro works well... I creates the e-mail however, the Command Buttons are pointing back to the Source file for the macro. I tried to re-assign the macros but no luck.
[vba]
Option Explicit
Sub SendEmail()
Dim Filename As String: Filename = "Product Supply Exception.xls"
Dim KillPath As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Application.StatusBar = "Generating Email..."
ThisWorkbook.Sheets("Product Supply Exception").Copy
With ActiveWorkbook
With .ActiveSheet
.Shapes("Button 1").Cut 'Deletes the e-mail button
'assigns the Macro back to the button - which is on sheet05
'it this correct?
.Shapes("Button 2").OnAction = "Sheet05.SubTotalByBrand"
.Shapes("Button 3").OnAction = "Sheet05.SubTotalByBU"
.Shapes("Button 4").OnAction = "Sheet05.SubTotalRemove"
.Shapes("Button 5").OnAction = "Sheet05.SubTotalBySKU"
End With
.SaveAs Filename
KillPath = .FullName
Application.Dialogs(xlDialogSendMail).Show
.Close False
End With
Kill KillPath
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.StatusBar = ""
End Sub
[/vba]