Avatar billede nyholm Novice
09. december 2007 - 13:57 Der er 14 kommentarer og
1 løsning

Send E-mail

Jag skickar e-mail från min db. Det gæller bl.a. Løneavi och Specifikation till Løneavi. Min fråga ær om det ær møjligt att få med 2 rapporter samtidigt som bifogade filer? Nu måste jag først skicka Løneavin och sedan Specifikationen.
Avatar billede terry Ekspert
09. december 2007 - 14:00 #1
Its possible if you use Outlook automation to send your emails.
Avatar billede terry Ekspert
09. december 2007 - 14:04 #2
Function SendMail()
Dim objOl As New Outlook.Application
Dim objPost As MailItem
Dim vedhæftet As Attachments
   
    Set objPost = objOl.CreateItem(olMailItem)
   
    Set vedhæftet = objPost.Attachments
    vedhæftet.Add "C:\Output.txt"
    vedhæftet.Add "c:\staff.xsl"
   
    With objPost
        .Subject = "Subject goes here"
        .To = "eksperten@santhell.dk"
        .Body = "Hej med Dig" & .Body 'Just in case we are using an autosignature
       
               
        .Display
       
    End With
 
  objOl.Quit
 
    Set objPost = Nothing
    Set vedhæftet = Nothing
   
Exit Function
Avatar billede terry Ekspert
09. december 2007 - 14:05 #3
These lines add two attachments
Avatar billede nyholm Novice
09. december 2007 - 15:26 #4
It's not 2 existing files, it's 2 reports from my db that I want to send as SnapShots.
Avatar billede terry Ekspert
09. december 2007 - 16:17 #5
Not sure you can. Cant you save the reports as snapshot files first?
Avatar billede nyholm Novice
09. december 2007 - 16:27 #6
Offcourse I can, but if I have 35 persons to send to, it will be a lot actions to do. I had hoped I could do it much easier.
Avatar billede terry Ekspert
09. december 2007 - 17:16 #7
?
If the same reports are sent to 35 people then then you just include them in the .To parameter just as you when you use

docmd.SendObject

.To = "eksperten@santhell.dk;nyholm@mail.dk"
Avatar billede nyholm Novice
09. december 2007 - 18:00 #8
It's not the same report. It is sallary notifications consists of 2 reports. One is how the sallary is calculated and the other is a specification of the data that the sallary is based on.
Avatar billede nyholm Novice
09. december 2007 - 18:04 #9
The only way it will simplyfie the mailing of the reports is if it's possible for the SendObject function to handle two objects at the same time.
Avatar billede terry Ekspert
09. december 2007 - 18:31 #10
Well if having to send two emails is simpler than using Outlook to send them both at once then great.

I have had a look around and as far as I know you can not send multiple attachments (objects) at the same time using cmd.SendObject
Avatar billede terry Ekspert
09. december 2007 - 18:31 #11
Docmd.SendObject
Avatar billede nyholm Novice
09. december 2007 - 18:58 #12
When I'm using the Docmd.SendObject it looks up the e-mail adress for that individual, it starts my mailingprogram. The procedure takes only two klicks. It can't be any simliper than that. It's just that I have to do it twize and send the two objects in two different mails.
Avatar billede nyholm Novice
09. december 2007 - 19:01 #13
I will give You the points anyhow. Over the time You have been most helpful and I appreciate wery much Your suggestions.
Avatar billede terry Ekspert
09. december 2007 - 19:02 #14
"...It's just that I have to do it twize and send the two objects in two different mails."

and thats what I'm saying cant be avoided using Docmd.SendObject.

I know the few lines of code is simpler than using Outlook, but to get around your problem you have to use another method
Avatar billede terry Ekspert
09. december 2007 - 19:39 #15
Thanks.
You dont have to give me points if you cant use the answer, but I think you will find that its the only option (not using Docmd.SendObject) to solve your problem.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester