Good morning all,
I am trying to get VBA to pull a sheet from a book, save as then attach to an email and finally put back into the book with the new tab name. The below code works right up until the end and will not put it back into the starting excel book. Any help is always appreciated. Thanks!
I am trying to get VBA to pull a sheet from a book, save as then attach to an email and finally put back into the book with the new tab name. The below code works right up until the end and will not put it back into the starting excel book. Any help is always appreciated. Thanks!
VBA Code:
' Share Macro
'
'
CurWkbk = ActiveWorkbook.Name
Sheets("IN_Picklist").Select
Sheets("IN_Picklist").Copy
ActiveSheet.DrawingObjects.Select
ActiveSheet.Shapes.Range(Array("Rectangle 1", "Button 1", "Button 2", _
"Button 3", "Button 4", "Button 5")).Select
Selection.Delete
Rows("8:8").Select
Selection.AutoFilter
'Get rid of Formulas
With ActiveWorkbook
Range("A1:AA6").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveCell.Select
Application.CutCopyMode = False
'Name Tab
ActiveSheet.Name = Format(Range("F3").Value, "mm-dd-yyyy")
CurSht = ActiveSheet.Name
'Save/Name File
Application.Dialogs(xlDialogSaveAs).Show Range("AA1").Value & " " & Range("AA3").Value & " " & " TOOL LIST " & Format(Range("AA2").Value, "mm-dd-yyyy") & ".xlsx"
CurTemp = ActiveWorkbook.Name
'Email It
Application.Dialogs(xlDialogSendMail).Show arg1:="[EMAIL]shop@nooter.com[/EMAIL]", arg2:=Range("AA1").Value & " " & Range("AA3").Value & " " & " TOOL LIST " & Format(Range("AA2").Value, "mm-dd-yyyy") & ".xlsx"
'Put Back In Book
'Windows(CurTemp).Activate
'Windows(CurWkbk).Activate
'Windows(CurSht).Select
Windows(CurWkbk).Activate
Windows(CurSht).Select
Windows(CurSht).Move After:=Windows(CurWkbk).Sheets(ActiveWorkbook.Sheets.Count)
Sheets("Job Information").Select
Range("D4").Select
'Windows(CurSht).Move After:=Windows(CurWkbk).Sheets
End With
Last edited by a moderator: