Results 1 to 4 of 4

Thread: Hyperlink Email Outlook

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2004
    Posts
    297

    Hyperlink Email Outlook

    When I put the string "File:\" & Application.ActiveWorkbook.Path
    (from Excel)
    into the body of an Email, the link in the email stops at the first space.
    Example: the full string becomes :"File:\C:\Program Files\Bla\Word.doc"
    the link stops between Program and Files.

    Does anyone knows how to make the spaces part of the link?

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Hyperlink Email Outlook

    How are you placing the link in the email? Manually or via code?

    You need to make sure your bodyformat is html and if your pasting manually then I believe you need to replace the spaces with "%20".

    Here is how to place a link in an html email via code.

    VB Code:
    1. Option Explicit
    2. 'Add a reference to MS Outlook xx.0 Object Library
    3. Private Sub Command1_Click()
    4.     Dim oApp As Outlook.Application
    5.     Dim oEmail As Outlook.MailItem
    6.     Set oApp = New Outlook.Application
    7.     Set oEmail = oApp.CreateItem(olMailItem)
    8.     oEmail.BodyFormat = olFormatHTML
    9.     oEmail.HTMLBody = "<A href='file://D:\Program Files'>D:\Program Files</A>" 'modify to your filepath
    10.     oEmail.Display
    11. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2004
    Posts
    297

    Re: Hyperlink Email Outlook

    Did you know that if you turn the back-slashes into slashes
    the file openes out of the internetexplorer?

    Now it openes in Iexplorer.
    Last edited by HWijngaarD; Jan 26th, 2006 at 03:01 AM.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2004
    Posts
    297

    Re: Hyperlink Email Outlook

    I thought I had it.
    I'm trying to open an Excel sheet in the email link.
    When I open the link from the email
    Excel openes the excelsheet within Iexplorer.
    How do I open this sheet out of the internet explorer??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width