+ Reply to Thread
Results 1 to 5 of 5

Sending e mail with attachment from button click

  1. #1
    pmud
    Guest

    Sending e mail with attachment from button click

    Hi,

    I have never used macros before..but i have created a button on excel
    sheet...a CommandButton1 . Now when this button is clicked a blank e - mail
    should open up with this spreadsheet attached to it...

    Is there any way this is possible? What code is required for this?

    Thanks

    --
    pmud

  2. #2
    Ron de Bruin
    Guest

    Re: Sending e mail with attachment from button click

    Hi Pmud

    Look at my site for code examples
    http://www.rondebruin.nl/sendmail.htm

    Maybe one of the Add-ins is the best choice for you
    http://www.rondebruin.nl/mail/add-in.htm


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "pmud" <[email protected]> wrote in message news:[email protected]...
    > Hi,
    >
    > I have never used macros before..but i have created a button on excel
    > sheet...a CommandButton1 . Now when this button is clicked a blank e - mail
    > should open up with this spreadsheet attached to it...
    >
    > Is there any way this is possible? What code is required for this?
    >
    > Thanks
    >
    > --
    > pmud




  3. #3
    Bob H
    Guest

    Re: Sending e mail with attachment from button click

    This code works for me:
    Sub Mailit()
    Dim BkName As String
    ActiveWorkbook.Save
    BkName = ActiveWorkbook.FullName
    Dim Mailit As Object
    Set Mailit = CreateObject("Outlook.Application")
    Set NewMail = Mailit.CreateItem(olMailItem)
    NewMail.Subject = ActiveWorkbook.Name
    NewMail.Attachments.Add BkName
    NewMail.Display
    End Sub

    Attach it to your button. If you want it available for any workbook, put the
    module in your personal workbook. Also, be sure the reference to Microsoft
    Visual Basic for Applications Extensibility (etc.) is checked under
    Tools/Refereces in the VBE
    >
    >
    >
    > "pmud" <[email protected]> wrote in message news:[email protected]...
    > > Hi,
    > >
    > > I have never used macros before..but i have created a button on excel
    > > sheet...a CommandButton1 . Now when this button is clicked a blank e - mail
    > > should open up with this spreadsheet attached to it...
    > >
    > > Is there any way this is possible? What code is required for this?
    > >
    > > Thanks
    > >
    > > --
    > > pmud

    >
    >
    >


  4. #4
    Bob H
    Guest

    Re: Sending e mail with attachment from button click

    On second thought , I had forgotten that Excel already provides w way to do
    this without programming. Just Click File/Send To/ Mail Recipient(as
    Attachment)

    "Bob H" wrote:

    > This code works for me:
    > Sub Mailit()
    > Dim BkName As String
    > ActiveWorkbook.Save
    > BkName = ActiveWorkbook.FullName
    > Dim Mailit As Object
    > Set Mailit = CreateObject("Outlook.Application")
    > Set NewMail = Mailit.CreateItem(olMailItem)
    > NewMail.Subject = ActiveWorkbook.Name
    > NewMail.Attachments.Add BkName
    > NewMail.Display
    > End Sub
    >
    > Attach it to your button. If you want it available for any workbook, put the
    > module in your personal workbook. Also, be sure the reference to Microsoft
    > Visual Basic for Applications Extensibility (etc.) is checked under
    > Tools/Refereces in the VBE
    > >
    > >
    > >
    > > "pmud" <[email protected]> wrote in message news:[email protected]...
    > > > Hi,
    > > >
    > > > I have never used macros before..but i have created a button on excel
    > > > sheet...a CommandButton1 . Now when this button is clicked a blank e - mail
    > > > should open up with this spreadsheet attached to it...
    > > >
    > > > Is there any way this is possible? What code is required for this?
    > > >
    > > > Thanks
    > > >
    > > > --
    > > > pmud

    > >
    > >
    > >


  5. #5
    pmud
    Guest

    Re: Sending e mail with attachment from button click

    Hi Ron,

    Thanks . that worked..

    Cheers

    "Ron de Bruin" wrote:

    > Hi Pmud
    >
    > Look at my site for code examples
    > http://www.rondebruin.nl/sendmail.htm
    >
    > Maybe one of the Add-ins is the best choice for you
    > http://www.rondebruin.nl/mail/add-in.htm
    >
    >
    > --
    > Regards Ron de Bruin
    > http://www.rondebruin.nl
    >
    >
    >
    > "pmud" <[email protected]> wrote in message news:[email protected]...
    > > Hi,
    > >
    > > I have never used macros before..but i have created a button on excel
    > > sheet...a CommandButton1 . Now when this button is clicked a blank e - mail
    > > should open up with this spreadsheet attached to it...
    > >
    > > Is there any way this is possible? What code is required for this?
    > >
    > > Thanks
    > >
    > > --
    > > pmud

    >
    >
    >


+ 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.6.0 RC 1