none
Excel 2007 attachment RRS feed

  • Question

  • Hi All,

    I am unable to send .xlsx,xlsm files as attachment in mail using C# code. However able to send xls file. Could someone please let me know if there is any code snippet to send mail excel 2007 workbook as attachment.

    Thanks.

    • Moved by 许阳(无锡)Moderator Tuesday, June 5, 2012 7:42 AM Outlook Issue (From:Visual Studio Tools for Office)
    Tuesday, May 29, 2012 1:11 PM

Answers

  • Thanks alot for your suggestions... we are unable to send mail since the excel instance was using the generated file. Able to send the file without any issues after closing the excel instance as soon as the excel file is generated.

    Thanks...

    Thursday, May 31, 2012 10:18 AM

All replies

  • what are you using to send mails?
    Tuesday, May 29, 2012 1:12 PM
  • Hi,

    Use system.net.mail namespace to send mail. However getting an error when attaching 2007 excel sheet using attachment. Even the exception is not getting caught.

    Thanks.

    Tuesday, May 29, 2012 1:22 PM
  • i guess you would be better off asking on general C# forum - this one is for VSTO technology.
    Tuesday, May 29, 2012 1:37 PM
  • Hi All,

    We have a C# application which generates excel workbooks and sends them in a mail. We are working on upgrading it to generate excel 2007 workbooks. We are able to generate 2007 excel workbooks (.xlsx,.xlsm) using the application However facing an issue when trying to send excel 2007 workbook as attachment in mail. Even the code is not catching the exception.Could someone pls let me know if there is anyway to send excel 2007 workbooks as attachment in mail.

    Thanks.

    Wednesday, May 30, 2012 7:09 AM
  • Could you provide us more details?

    What kind of issue are you facing?


    Marco Minerva [MCPD]
    Blog: http://blogs.ugidotnet.org/marcom
    Twitter: @marcominerva

    Wednesday, May 30, 2012 7:49 AM
  • On debugging the code, debugger moves to catch statement and jumps of from there without catching the exception. This happens only when attaching excel 2007 workbook (i.e. .xlsx,xlsm).

    Able to send mails with excel 2003 workbook as attachment. Could you please let me know if there is anyway to send mail with excel 2007 workbook as attachment.

    Thanks.

    Wednesday, May 30, 2012 10:07 AM
  • Sending Excel 2007 attachments isn't diffrent from sending any other file types. Probably, the problem lies in the way to create the file and attach it to the mail.

    Without seeing the code with which you try to send the mail, it is impossible to help you.


    Marco Minerva [MCPD]
    Blog: http://blogs.ugidotnet.org/marcom
    Twitter: @marcominerva

    Wednesday, May 30, 2012 10:16 AM
  • Thanks alot for your suggestions... we are unable to send mail since the excel instance was using the generated file. Able to send the file without any issues after closing the excel instance as soon as the excel file is generated.

    Thanks...

    Thursday, May 31, 2012 10:18 AM