Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send file as link in outlook

Status
Not open for further replies.

crabback

Technical User
Jan 29, 2007
64
IE
Hi
I've written a macro in word that when run copies the file name and path into a new document as hyperlinked text, and opens the document for emailing.

I want to recreate the same macro in Outlook 2003. At the moment as long as I give the file and path in the code, it works fine... But I want instead to open the 'Browse for file' window, and take the file path and name from here so my user can specify a different file each time.

Does anyone know how to do this, or where I can find an FAQ that will tell me how?

This is my code:

Sub SendAsLink()

Dim docpath, docname As String
' values I want to get from a browse window
docpath = "H:\test.doc"
docname = "test.doc"

Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.Subject = "Link to " & docname
.Body = "file:" & docpath
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing

End Sub

Thanks

Crabback
 
Have a look at the Office.FileDialog object.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top