Results 1 to 2 of 2

emp enters data and gets work list emailed

Threaded View

  1. #1
    Registered User
    Join Date
    12-15-2015
    Location
    Vancouver, Canada
    MS-Off Ver
    2013
    Posts
    1

    emp enters data and gets work list emailed

    i've currently got an excel spreadsheet where employee's go and put there name and employee number and then highlight the selected work and it will be emailed to them.

    what i really want is a box on sheet 1 where an employee can enter a number "50-500" and their employee number in another box and have their name updated to next amount requested and updated to the spreadsheet on sheet 2 in Cells D7 on.

    the employee number would update starting at sheet 2 D7 and to find the next available empty data would be in column D and would end at a variable number in column D that would be updated in sheet 2 Cell C3

    i want it to open and update excel and send it as an attachment. (mine's doing it now.)

    there has to be a better way. so i'd really like someone who knows what they're doing to help the less fortunate out.
    any help is greatly appreciated.

    here's my macro.

    Sub Mail_Range()
    
        Dim Source As Range
        Dim Dest As Workbook
        Dim Wb As Workbook
        Dim TempFilePath As String
        Dim TempFileName As String
        Dim FileExtStr As String
        Dim FileFormatNum As Long
        Dim OutApp As Object
        Dim OutMail As Object
        
        Set Source = Nothing
        On Error Resume Next
        Set Source = ActiveSheet.Range
                        CurrentRegion.Select
                        Selection.Copy
        On Error GoTo 0
     
        With Application
            .ScreenUpdating = False
            .EnableEvents = False
    
        Set OutApp = CreateObject("Outlook.Application")
    
        Set Wb = ActiveWorkbook
        Set Dest = Workbooks.Add(xlWBATWorksheet)
    
        
        With Dest.Sheets(1)
            .Cells(1).PasteSpecial Paste:=8
            .Cells(1).PasteSpecial Paste:=xlPasteValues
            .Cells(1).PasteSpecial Paste:=xlPasteFormats
            .Cells(1).Select
            Application.CutCopyMode = False
        End With
    
        TempFilePath = Environ$("temp") & "\"
        TempFileName = "LVS assignment " & " " _
                     & Format(Now, "dd-mmm-yy")
    
        FileExtStr = ".xlsx": FileFormatNum = 51
       
        With Dest
            .SaveAs TempFilePath & TempFileName & FileExtStr, _
                    FileFormat:=FileFormatNum
        
            Set OutMail = OutApp.CreateItem(0)
           
            With OutMail
                .To = Range("E1") & ("@XXXXX.com")
                .Subject = "XXX"
                .body = "Here's the you've selected to work"
                .attachments.Add (TempFilePath & TempFileName & FileExtStr)
                .send
            End With
            On Error GoTo 0
            Set OutMail = Nothing
                    
            .Close SaveChanges:=False
        End With
    
        Kill TempFilePath & TempFileName & FileExtStr
    
        With Application
            .ScreenUpdating = True
            .EnableEvents = True
        End With
    End With
    End Sub
    Last edited by alansidman; 12-15-2015 at 03:37 PM. Reason: code tags added

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Find data in field with Alt Enters
    By NS4Excel in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-07-2014, 07:18 PM
  2. [SOLVED] UserForm Enters Final Data Into First Row
    By LoneWolf3574 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-01-2012, 07:46 PM
  3. Data Validation Not Working With emailed File
    By bizhelp9 in forum Excel General
    Replies: 1
    Last Post: 12-05-2011, 11:59 AM
  4. Splitting Data with Enters
    By Stiffler in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-04-2010, 08:25 AM
  5. A List of Everything that enters a cell
    By Latszer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-20-2009, 05:12 AM
  6. Importing emailed data into excel
    By Noobish in forum Excel General
    Replies: 1
    Last Post: 10-23-2008, 10:50 AM
  7. Code does not work on emailed file
    By EFWY in forum Excel General
    Replies: 3
    Last Post: 10-24-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1