vba function for form

K

Kevin

Hi

My question is as follows
Could somebody provide me with some vba code which supplies me with a button on
a word form that when clicked will automatically send the form to a specified
email adres

Thanks
 
H

Helmut Weber

Hi Kevin,
like this:

Sub MyMail()
' Extras References Check Outlook-Library !!!
Dim Otl As Outlook.Application
Set Otl = New Outlook.Application
Dim OtlItem As MailItem
With Otl
Set OtlItem = .CreateItem(olmailitem)
With OtlItem
.To = "(e-mail address removed)"
.Subject = "Hi and higher"
.attachments.Add ActiveDocument.FullName
.Display ' for testing
' .Send ' send
End With
End With
end sub

I'd suggest saving the doc beforehand.

Creating a button and attaching the macro to it
should not be a problem, I think.

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top