Results 1 to 2 of 2
  1. #1
    NISMOJim is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2010
    Posts
    273

    Hyperlink not working

    I'm trying to add a hyperlink to an email, but keep getting a Run Time Error 91. Object variable or With block variable not set. Here is the code...

    Dim MsgBody As String
    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Dim Hyp As Hyperlink
    Hyp = "http://Y:\Purchasing.accdb"

    MsgBody = "Please approve the Purchase Request located at " & Hyp & " from " & Me.txtLUEmpName & "." & "<br>" & "Thank you."


    Set appOutLook = CreateObject("Outlook.Application")


    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    With MailOutLook
    .BodyFormat = olFormatRichText
    .To = Me.txtEmpM
    .Subject = "Please Approve Purchase Request"
    .HTMLBody = MsgBody
    '.DeleteAfterSubmit = True 'This would let Outlook send the note without storing it in your sent bin
    .Display
    End With


    The Hyp =... line is what is highlighted with the error. I have typed the address to the database, as well as copied & pasted, but keep getting this error. Any ideas while still using this format as opposed to learning the HTML version?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    1. you dont need HTTP for local hard drives. http is only for web sites.

    2. DONT use drive letters for hard drive paths. Not everone my have the Y drive mapped.
    use UNC paths: "\\server\folder\folder\purchasing.accdb

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 02-23-2016, 10:57 AM
  2. Hyperlink Control not working.
    By MatthewGrace in forum Access
    Replies: 2
    Last Post: 11-27-2015, 01:23 PM
  3. Hyperlink in subform not working
    By bradp1979 in forum Forms
    Replies: 8
    Last Post: 08-13-2015, 02:58 PM
  4. Replies: 4
    Last Post: 01-31-2011, 03:19 PM
  5. Open up url page hyperlink not working!
    By riffraff_ashraf in forum Forms
    Replies: 1
    Last Post: 09-29-2010, 09:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums