+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25

Thread: Copy range to new workbook, save and email

  1. #16
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: Copy range to new workbook, save and email

    Would have been simpler if you'd copied and pasted my code into your workbook rather than taking random bits of it...

    anyway, you need to alter this line:
            .Range("A2:B" & NR & ",E2:E" & NR & ",G2:G" & NR & ",J2:L" & NR).Copy Destination:=Destwb.Range("Area")
    to this:
            .Range("A2:B" & NR & ",E2:E" & NR & ",G2:G" & NR & ",J2:L" & NR).Copy Destination:=Destwb.Worksheets("Sheet1").Range("Area")

  2. #17
    Valued Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    446

    Re: Copy range to new workbook, save and email

    Ok,

    I have copy and pasted your code and replaced that line..

    I think we are nearly there, the error message is saying

    Message 'save as' of object 'workbook_' failed

  3. #18
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: Copy range to new workbook, save and email

    Yeah, I just noticed that - the SaveAs line should be:
           .SaveAs SaveStr & FileExtStr, FileFormat:=FileFormatNum

  4. #19
    Valued Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    446

    Re: Copy range to new workbook, save and email

    Thats cracked it! Thanks

    You don't know how I can get it to put the To address in for the email?

  5. #20
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: Copy range to new workbook, save and email

    You should already have that in your code, no?

  6. #21
    Valued Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    446

    Re: Copy range to new workbook, save and email

    I though I did but it is just opening the email and filling out the subject and attaching the file

    I will say I am using First Class as my email application (its a college so we don't have outlook, sadly)

  7. #22
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: Copy range to new workbook, save and email

    It works for me, putting "me@myemail.ac.uk" as the address. I am using Outlook, though. Never heard of First Class, but if it's MAPI compliant then it should work.

  8. #23
    Valued Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    446

    Re: Copy range to new workbook, save and email

    yeah it has mapi but its called fcsmapi.dll does that matter or not?

    Can it also send the email completely, as in you don't press send?

    Cheers,

    Andy

  9. #24
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: Copy range to new workbook, save and email

    I've no idea what fcsmapi is as I assume it's proprietary. For me, your code sends the email rather than displaying it (once you say yes to the Outlook security prompt).

  10. #25
    Valued Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    446

    Re: Copy range to new workbook, save and email

    ok thank you so much for all your help, I will have to see if I can get some info off IT.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0