+ Reply to Thread
Results 1 to 3 of 3

Copy, Sendemail, Killfile

  1. #1
    Registered User
    Join Date
    05-16-2011
    Location
    Virginia Beach, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Copy, Sendemail, Killfile

    I have a main workbook that contains a funding request blank worksheet - like a template -and the remaining worksheets in the book are filled in funding requests.

    When I fill out a new request I want to email just the new sheet and save a copy to the end of the main workbook. I no longer need the temporary copy that I email because I'm going to have a copy at the end of the main workbook. I drafted up this code which works for the most part as far as sending a copy - it does work but it also generates a Run-time error '53': File not found - I presume from killing the temporary file.

    My question is, "How do I eliminate this error box from displaying?"

    Thanks in advance!



    Sub SendOneSheet()
    Dim Filename As String
    Filename = InputBox("Please name the file ")
    ActiveWorkbook.Worksheets.Copy
    ActiveWorkbook.SaveAs Filename
    ActiveWorkbook.SendMail "[email protected]", InputBox("Please type subject")
    ActiveWorkbook.Close False
    Kill Filename

    End Sub
    Last edited by Ambassador777; 06-01-2011 at 03:07 PM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Copy, Sendemail, Killfile

    Hi Ambassador777, before anyone is able to help you, you need to enclose your code with code tags. To do so, click here and read Rule 3 to find out how.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: Copy, Sendemail, Killfile

    Hi Ambassador777
    In anticipation of you using code tags ....
    Try adding the file extension to Filename before killing it.
    barry

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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