ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   emailing Spreadsheet? (https://www.excelbanter.com/excel-programming/280294-emailing-spreadsheet.html)

scott[_7_]

emailing Spreadsheet?
 
I have an access database that spits out an excel file to
my C drive...is there a way that I can have this file
automatically emailed to someone?

I checked the access NG and they said to check here
because the file was now an excel file.

I want to run the access database
It spits out the excel file and automatically emails it to
certain people.

Thanks for all your help.
Scott

Ron de Bruin

emailing Spreadsheet?
 
Hi scott

If you use Outlook??

I think you can use this without any problems in Access VBA


Sub Mail_workbook_Outlook()
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
'You can add files like this
.Attachments.Add ("C:\test.xls")
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"scott" wrote in message ...
I have an access database that spits out an excel file to
my C drive...is there a way that I can have this file
automatically emailed to someone?

I checked the access NG and they said to check here
because the file was now an excel file.

I want to run the access database
It spits out the excel file and automatically emails it to
certain people.

Thanks for all your help.
Scott




Scott

emailing Spreadsheet?
 
Thank you for this info..I do have one question..Where do
I put the code and how do I run it? I tried copying it
into a macro and using RUN CODE in macro like this

RUNCODE Mail_workbook_Outlook()

but I got an error.

I am using access 97.

Thank you for all your help.

Scott
-----Original Message-----
Hi scott

If you use Outlook??

I think you can use this without any problems in Access

VBA


Sub Mail_workbook_Outlook()
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
'You can add files like this
.Attachments.Add ("C:\test.xls")
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"scott" wrote in

message ...
I have an access database that spits out an excel file

to
my C drive...is there a way that I can have this file
automatically emailed to someone?

I checked the access NG and they said to check here
because the file was now an excel file.

I want to run the access database
It spits out the excel file and automatically emails it

to
certain people.

Thanks for all your help.
Scott



.


Ron de Bruin

emailing Spreadsheet?
 
The code you must place in a normal module
Did you add a reference to Outlook?

1) Go to the VBA editor, Alt -F11
2) ToolsReferences in the Menu bar
3) Place a Checkmark before Microsoft Outlook ? Object Library
? is the Excel version number



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"scott" wrote in message ...
Thank you for this info..I do have one question..Where do
I put the code and how do I run it? I tried copying it
into a macro and using RUN CODE in macro like this

RUNCODE Mail_workbook_Outlook()

but I got an error.

I am using access 97.

Thank you for all your help.

Scott
-----Original Message-----
Hi scott

If you use Outlook??

I think you can use this without any problems in Access

VBA


Sub Mail_workbook_Outlook()
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
'You can add files like this
.Attachments.Add ("C:\test.xls")
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"scott" wrote in

message ...
I have an access database that spits out an excel file

to
my C drive...is there a way that I can have this file
automatically emailed to someone?

I checked the access NG and they said to check here
because the file was now an excel file.

I want to run the access database
It spits out the excel file and automatically emails it

to
certain people.

Thanks for all your help.
Scott



.





All times are GMT +1. The time now is 05:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com