SENDTO ?

T

TimberWolfe21

I created a form in HTM format in WORD.
I can add a hyperlink to MAILTO: some people.
But, is there a way to change this hyperlink to send the page, opening up a
new email, have it already addressed and all I have to do now is SEND?
 
G

Graham Mayor

You need a macro something along the lines of

Sub SendDocumentAsAttachment()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

On Error Resume Next

If Len(ActiveDocument.Path) = 0 Then
ActiveDocument.Save
End If

Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If

Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem
.To = "(e-mail address removed)"
.Subject = "New subject" 'subject text
.Body = "See attached document" 'e-mail body text
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue
.Send
End With

If bStarted Then
oOutlookApp.Quit
End If

Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub

You will need to set the Outlook object library in Word vba for this to
work.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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