+ Reply to Thread
Results 1 to 4 of 4

emailing a workbook from within excel

  1. #1
    Damien
    Guest

    emailing a workbook from within excel

    I have tried using both of the following methods, to send an email from
    within a workbook, both have failed. The purpose for this is to notify a
    manager that a report is to be looked at. I hope that someone can help.
    Cheers D



    Sub Mail_workbook_Outlook()
    'This example send the last saved version of the Activeworkbook
    Dim OutApp As Object
    Dim OutMail As Object
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    With OutMail
    .To = cboxProjectDirector.Value & "@aqis.gov.au"
    .CC = ""
    .BCC = ""
    .Subject = cboxProjectList.Value & " Status Report" & Format(Date,
    "dd/mmm/yy") & ".xls"
    .Body = "Hi there"
    .Attachments.Add ActiveWorkbook.FullName
    .Send
    End With
    Set OutMail = Nothing
    Set OutApp = Nothing
    End Sub



    Private Sub MailWorkbook()

    ThisWorkbook.SendMail (cboxProjectDirector.Value &
    "@aqis.gov.au",cboxProjectList.Value & " Status Report" & Format(Date,
    "dd/mmm/yy"))

    End Sub

  2. #2
    Corey
    Guest

    Re: emailing a workbook from within excel

    Damien,
    Have a look here:
    http://www.rondebruin.nl/sendmail.htm


    --
    Regards

    Corey

    "Damien" <[email protected]> wrote in message
    news:[email protected]...
    >I have tried using both of the following methods, to send an email from
    > within a workbook, both have failed. The purpose for this is to notify a
    > manager that a report is to be looked at. I hope that someone can help.
    > Cheers D
    >
    >
    >
    > Sub Mail_workbook_Outlook()
    > 'This example send the last saved version of the Activeworkbook
    > Dim OutApp As Object
    > Dim OutMail As Object
    > Set OutApp = CreateObject("Outlook.Application")
    > Set OutMail = OutApp.CreateItem(0)
    > With OutMail
    > .To = cboxProjectDirector.Value & "@aqis.gov.au"
    > .CC = ""
    > .BCC = ""
    > .Subject = cboxProjectList.Value & " Status Report" & Format(Date,
    > "dd/mmm/yy") & ".xls"
    > .Body = "Hi there"
    > .Attachments.Add ActiveWorkbook.FullName
    > .Send
    > End With
    > Set OutMail = Nothing
    > Set OutApp = Nothing
    > End Sub
    >
    >
    >
    > Private Sub MailWorkbook()
    >
    > ThisWorkbook.SendMail (cboxProjectDirector.Value &
    > "@aqis.gov.au",cboxProjectList.Value & " Status Report" & Format(Date,
    > "dd/mmm/yy"))
    >
    > End Sub




  3. #3
    Damien
    Guest

    Re: emailing a workbook from within excel

    Hi Corey,
    I have looked at Ron's website and with the following code I still get an
    error message saying object required on the .To= cboxProjectDirector.Value &
    "@aqis.gov.au" line of code. D

    Sub Mail_workbook_Outlook()
    'This example send the last saved version of the Activeworkbook
    Dim OutApp As Outlook.Application
    Dim OutMail As Outlook.MailItem
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(olMailItem)
    With OutMail
    .To = cboxProjectDirector.Value & "@aqis.gov.au"
    .CC = ""
    .BCC = ""
    .Subject = cboxProjectList.Value & " Status Report" & Format(Date,
    "dd/mmm/yy") & ".xls"
    .Body = "Test email"
    .Attachments.Add ActiveWorkbook.FullName
    .Send
    End With
    Set OutMail = Nothing
    Set OutApp = Nothing
    End Sub




    "Corey" wrote:

    > Damien,
    > Have a look here:
    > http://www.rondebruin.nl/sendmail.htm
    >
    >
    > --
    > Regards
    >
    > Corey
    >
    > "Damien" <[email protected]> wrote in message
    > news:[email protected]...
    > >I have tried using both of the following methods, to send an email from
    > > within a workbook, both have failed. The purpose for this is to notify a
    > > manager that a report is to be looked at. I hope that someone can help.
    > > Cheers D
    > >
    > >
    > >
    > > Sub Mail_workbook_Outlook()
    > > 'This example send the last saved version of the Activeworkbook
    > > Dim OutApp As Object
    > > Dim OutMail As Object
    > > Set OutApp = CreateObject("Outlook.Application")
    > > Set OutMail = OutApp.CreateItem(0)
    > > With OutMail
    > > .To = cboxProjectDirector.Value & "@aqis.gov.au"
    > > .CC = ""
    > > .BCC = ""
    > > .Subject = cboxProjectList.Value & " Status Report" & Format(Date,
    > > "dd/mmm/yy") & ".xls"
    > > .Body = "Hi there"
    > > .Attachments.Add ActiveWorkbook.FullName
    > > .Send
    > > End With
    > > Set OutMail = Nothing
    > > Set OutApp = Nothing
    > > End Sub
    > >
    > >
    > >
    > > Private Sub MailWorkbook()
    > >
    > > ThisWorkbook.SendMail (cboxProjectDirector.Value &
    > > "@aqis.gov.au",cboxProjectList.Value & " Status Report" & Format(Date,
    > > "dd/mmm/yy"))
    > >
    > > End Sub

    >
    >
    >


  4. #4
    Ron de Bruin
    Guest

    Re: emailing a workbook from within excel

    Hi Damien

    Is cboxProjectDirector a named cell or ?


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



    "Damien" <[email protected]> wrote in message news:[email protected]...
    > Hi Corey,
    > I have looked at Ron's website and with the following code I still get an
    > error message saying object required on the .To= cboxProjectDirector.Value &
    > "@aqis.gov.au" line of code. D
    >
    > Sub Mail_workbook_Outlook()
    > 'This example send the last saved version of the Activeworkbook
    > Dim OutApp As Outlook.Application
    > Dim OutMail As Outlook.MailItem
    > Set OutApp = CreateObject("Outlook.Application")
    > Set OutMail = OutApp.CreateItem(olMailItem)
    > With OutMail
    > .To = cboxProjectDirector.Value & "@aqis.gov.au"
    > .CC = ""
    > .BCC = ""
    > .Subject = cboxProjectList.Value & " Status Report" & Format(Date,
    > "dd/mmm/yy") & ".xls"
    > .Body = "Test email"
    > .Attachments.Add ActiveWorkbook.FullName
    > .Send
    > End With
    > Set OutMail = Nothing
    > Set OutApp = Nothing
    > End Sub
    >
    >
    >
    >
    > "Corey" wrote:
    >
    >> Damien,
    >> Have a look here:
    >> http://www.rondebruin.nl/sendmail.htm
    >>
    >>
    >> --
    >> Regards
    >>
    >> Corey
    >>
    >> "Damien" <[email protected]> wrote in message
    >> news:[email protected]...
    >> >I have tried using both of the following methods, to send an email from
    >> > within a workbook, both have failed. The purpose for this is to notify a
    >> > manager that a report is to be looked at. I hope that someone can help.
    >> > Cheers D
    >> >
    >> >
    >> >
    >> > Sub Mail_workbook_Outlook()
    >> > 'This example send the last saved version of the Activeworkbook
    >> > Dim OutApp As Object
    >> > Dim OutMail As Object
    >> > Set OutApp = CreateObject("Outlook.Application")
    >> > Set OutMail = OutApp.CreateItem(0)
    >> > With OutMail
    >> > .To = cboxProjectDirector.Value & "@aqis.gov.au"
    >> > .CC = ""
    >> > .BCC = ""
    >> > .Subject = cboxProjectList.Value & " Status Report" & Format(Date,
    >> > "dd/mmm/yy") & ".xls"
    >> > .Body = "Hi there"
    >> > .Attachments.Add ActiveWorkbook.FullName
    >> > .Send
    >> > End With
    >> > Set OutMail = Nothing
    >> > Set OutApp = Nothing
    >> > End Sub
    >> >
    >> >
    >> >
    >> > Private Sub MailWorkbook()
    >> >
    >> > ThisWorkbook.SendMail (cboxProjectDirector.Value &
    >> > "@aqis.gov.au",cboxProjectList.Value & " Status Report" & Format(Date,
    >> > "dd/mmm/yy"))
    >> >
    >> > End Sub

    >>
    >>
    >>




+ 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