send current form via email

peterjb44

Registered User.
Local time
Today, 22:41
Joined
Mar 7, 2013
Messages
55
Hi All,

i've looked this forum for working code to send current form via email, but nothing seems to work for me, i did manage to find code what did work to send email when i click button on the form, but there is no code in it to save current form and send that.

this is the code i found, is there a way to add more code to this to get it to send current form?

Private Sub eMail_Click()

Dim olApp As Object
Dim objMail As Object

On Error Resume Next 'Keep going if there is an error


Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open


If Err Then 'Outlook is not open
Set olApp = CreateObject("Outlook.Application") 'Create a new instance of Outlook
End If

'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)

With objMail

'Set body format to HTML
.BodyFormat = olFormatHTML
.To = "myemail@mywebsite.co.uk"
.Subject = "Task Assigned"
.HTMLBody = "Text"
.send

End With

MsgBox "Operation completed successfully"

End Sub


thanks


peter
 
If you mean data off the current form, this type of thing:

.HTMLBody = "Text" & Me.TextboxOnForm & "more text" & Me.AnotherTextbox
 
Hi pbaldy,

thanks for your reply

yes sorry, all the data off the current form

.HTMLBody = "Text" & Me.TextboxOnForm & "more text" & Me.AnotherTextbox

that works for customer details - which is a start (even tho i would need about 20 extras, lol)...........thanks for that :)

but i also have a customer equipment data sheet on the form too, how can i send that?

i would of liked to keep layout too

BTW i am a novice at this :o

thanks again


peter
 
I would probably send a report as a PDF attachment to the email. You have a lot more control over reports than forms when printing and such.
 
ok, i will try to do a report, then i guess i will try codes on this forum again....maybe thats why they didn't work!!

thanks


peter
 
At its simplest you can use SendObject to send the report. With the code you're currently using, you'd have to save the report as a pdf file and then attach it. Doable, but more steps.
 

Users who are viewing this thread

Back
Top Bottom