![]() |
|
#1
|
|||
|
|||
|
Hello..,. I need to email a hyperlink with the filepath from a word doc.
My googling skills have failed me, and thus far I haven't found success in the forums. office 07 Thanks, Jack |
|
#2
|
||||
|
||||
|
hi Jack,
You've posted this in the Word vba forum, but there's nothing in your post to suggest that vba is involved. Please clarify.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
My apologies. I'm looking for a vba solution (I can do similar things in excel vba).
This thread better expresses my desire: https://www.msofficeforums.com/word-...hyperlink.html |
|
#4
|
|||
|
|||
|
well, that thread's 10 months old without any response.
his question is: To all, Hopefully someone will be able to help. I am trying to write a macro script to do the following... Get the current filepath of the active word document. I can do this with a filepath = ActiveDocument.Path line. Then I want to open up outlook and email that filepath as a hyperlink in the body of the text. Bascially so I can send the document to someone quickly but only the filepath and not the full document. can anyone help? Thanks. |
|
#5
|
||||
|
||||
|
It's still not clear what you want to do. ActiveDocument.FullName will return the document's full path and name, which you can then add to an email. For example, assuming early binding:
Code:
Sub Test()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
' Check if Outlook is running. If it is not, start Outlook
On Error Resume Next
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
.Subject = "Test"
.Body = "File://" & ActiveDocument.FullName
.To = "jack22@someaddress.com"
.Send
End With
' Close Outlook if it was started by this macro.
If bStarted Then
oOutlookApp.Quit
End If
'Clean up
Set oItem = Nothing: Set oOutlookApp = Nothing
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#6
|
||||
|
||||
|
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#7
|
|||
|
|||
|
This was extremely helpful. Thank you!
Using this your sample code plus some others, I am able to successfully execute doing the following: PHP Code:
PHP Code:
|
|
#8
|
||||
|
||||
|
You need to set a reference to Outlook in the vb editor. See under Tools|References.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hyperlink to direct email | JaHoffman | Word | 5 | 07-05-2012 08:09 AM |
| Word macro to email hyperlink | pooley343 | Word VBA | 0 | 07-20-2011 01:48 AM |
| Hyperlink to attached file in email message | spino | Outlook | 0 | 08-05-2010 05:56 AM |
| cannot access hyperlink in email | mdrvo | Outlook | 1 | 05-31-2010 12:35 PM |
| Cannot hyperlink from an email | karen1430 | Outlook | 0 | 11-25-2007 03:54 PM |