Almost There...

esitze

New Member
Joined
Aug 24, 2018
Messages
18
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!

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:

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top