Easy way to create an email with a hyperlink to a document

I

Industrial Numbat

I need a way to create a button wherein when it is clicked, it opens up a
blank email and inserts a hyperlink to the document I am working on. The
problem is often when several people need to work on a time-sensitive
document, each person saves their changes as a separate document, with each
separate document not containing the other users changes. I figured the best
way round this was to use a hyperlink to the document so multiple versions
don't get saved, but some of the users are total beginners, and the method to
insert a hyperlink in an email is too complicated for them, so they just save
the document under another name. I want to create something, a button, where
they can click it, and an email opens up and the hyperlink to the document
they are working on (yes, it must be saved already with an established name)
is inserted into the email, they then enter the address and send. THen they
close the document, the email recipient opens the email, clicks on the
hyperlink and does their changes to the document. What is the best way to
create this macro/template. Thank you.
 
G

Graham Mayor

The essential problem here is that Word is not a multi-user application.
Only one person can have control of a document at a time. Frankly - even if
all the users have access to the same document location, I don't see how it
resolves your problem as only one can open it a time. However if you want to
try it and assuming the users have Outlook as the default e-mail
application:

Sub Send_Hlink_As_EMail()
' send the document in an Outlook Email message
' 2007/9 Graham Mayor, Tony Jollans, Doug Robbins
' & Sue Mosher
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
Dim objDoc As Word.Document
Dim strEMail As String
Dim DocPath As String
'The name of the document to be hyperlinked
DocPath = "D:\My Documents\Word documents\Docname.docx"
'*********************************************
'Create a new document
Documents.Add
'Insert a Hyperlink to the document
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
DocPath, _
SubAddress:="", _
ScreenTip:="", _
TextToDisplay:= _
"CTRL+Click to access document"
'Copy the document content
ActiveDocument.Range.Copy
strEMail = "<PR_EMAIL_ADDRESS>"
'Let the user choose the contact from Outlook
'And assign the email address to a variable
strEMail = Application.GetAddress("", strEMail, _
False, 1, , , True, True)
If strEMail = "" Then
MsgBox "User cancelled or no address listed", , "Cancel"
End If
On Error Resume Next
'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")
'Outlook wasn't running, start it from code
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
End If
'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)
Set objDoc = oItem.GetInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
With oItem
.to = strEMail
.Subject = "Document for Review"
.Display
objSel.Paste
End With
'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
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