Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email Excel Workbook from Access

Status
Not open for further replies.

KatGraham

Programmer
Feb 12, 2003
58
US
How do I email an Excel Workbook from Access?
 
if the workbook is an attached object, you can use DOCMD.SendObject as either a macro or in code. Look in the help file under SendObject.
 
Kat,

DoCmd.SendObject will only work if you want to send an Access object in spreadsheet format.

If this is what you want to do, the syntax is:

DoCmd.SendObject acSendTable, "YourTableName", acFormatXLS, etc...

For a query replace the first argument with acSendQuery.

If you're looking to email an existing spreadsheet I have some GroupWise compatible code I can post - not perfect but should give you a start

Iain
 
Then there's also this thread thread702-396121 (rather long), dealing with most aspects of e-mailing from Access.

Roy-Vidar
 
I am trying to email three existing MS Excel Workbooks from Access via a button. Any code would be great!
 
Do a keyword search in this forum for outlook attachment

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Kat,

Code to use GroupWise:

Code:
Sub email()

'*****************************************************
'Requires Groupware Type Library reference
'*****************************************************

Dim gwapp As GroupwareTypeLibrary.Application
Dim gwmessage As GroupwareTypeLibrary.Message
Dim gwaccount As GroupwareTypeLibrary.Account
Dim gwrecipient As GroupwareTypeLibrary.Recipient

Set gwapp = New GroupwareTypeLibrary.Application
Set gwaccount = gwapp.Login()

    Set gwmessage = gwaccount.MailBox.Messages.Add

    With gwmessage
   
        .Subject = "Subject"
        .FromText = "From"
        .bodytext = "Your Text Here"
        
        .Attachments.Add "Your File 1"
        .Attachments.Add "Your File 2"
        .Attachments.Add "Your File 3"

    End With
    
    Set gwrecipient = gwmessage.Recipients.Add("recipient email address")

    With gwrecipient

        .EmailType = ""
        .DisplayName = "Display Name of Recipient" 'Optional
        .Resolve

    End With

    gwmessage.send
    
Set gwrecipient = Nothing
Set gwmessage = Nothing
Set gwaccount = Nothing
Set gwapp = Nothing

End Sub

Hope that points you in the right direction :)
 
Oops, forgot - you need to put in a vbCrLf after the body text as for some reason it gets truncated by one character otherwise!

Iain
 
Hi Kat

I was looking though the code that you posted which works great, I have been looking everyone on the net and this is the closest I could find to what I want to do.

I have Microsft Access that has GroupwareTypeLibrary referenced.I am also working with groupwise client 6.02

I was trying to find documentation on GroupwareTypeLibrary for Access but could not find any.


What I am looking to do is have attachements automatically downloaded to a specified folder on my c drive and then delete the messege after it has been downloaded.

If you can give me some help with this or if you can point me to the right direction as to where I could get documentation to set this up on my own I would appreciate it.

Thank You
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top