Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Chicago, Illinois, USA
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Outlook/vbscript: link to a pdf file (Outlook 2000/vbscript form)

    Afternoon all. I have successfully used the code below (originally borrowed from slipstick.com) to make a label control appear to be a link. However, we have added some security to the "resumes" folder in the path, which means IE cannot open the link. I can, however, type the link directly into, say, Word or the Run line, and Acrobat Reader opens the file for me.

    My question is this--how can I reference Acrobat Reader instead of InternetExplorer? When I try to simply replace InternetExplorer.Application with AcrobatReader.Application, I get an error that reads "ActiveX Component can't create object: 'AcrobatReader.Application'" Is there a way around this? Any thoughts would be appreciated...


    Sub lblLink_Click()

    Set oWeb=CreateObject("InternetExplorer.Application") 'THIS IS WHAT I UNSUCCESSFULLY REPLACED WITH ADOBEREADER.APPLICATION
    Set oPage=Item.GetInspector.ModifiedFormPages("Intervi ew Details")
    Set oControl=oPage.Controls("lblLink")
    Set strCandidateString=item.UserProperties.Find("Candi date")
    strCandidateString=Replace(strCandidateString, ", ", "")
    oLink="File:///m:/recruiting/resumes/" & strCandidateString & ".pdf"
    oLink=cStr(oLink)
    msgbox oLink
    oWeb.Navigate oLink
    oWeb.visible=true

    End Sub

    Thanks in advance...

    klyjen

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Outlook/vbscript: link to a pdf file (Outlook 2000/vbscript form)

    I don't think there is a ready way to automate Acrobat Reader as a COM object, but... I haven't dug into it deeply because I have a rare version of Acrobat ("Business Tools") on my PC.

    Can you access the Windows Script Host from this context? If so, you could try using code similar to the examples linked in <!post=Post #165353,165353>Post #165353<!/post>. Both create a Shell object and use its .Run method, which is the equivalent of the Start

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Chicago, Illinois, USA
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Outlook/vbscript: link to a pdf file (Outlook 2000/vbscript form)

    Thanks! That is what I ended up doing...here's the code I used, for future reference...

    Dim ShellRun, oPage, oControl
    Set ShellRun = item.Application.CreateObject("Wscript.Shell")
    Set oPage=Item.GetInspector.ModifiedFormPages("myFormP age")
    Set strCandidateString=item.UserProperties.Find("Candi date")
    strCandidateString=Replace(strCandidateString, ", ", "")
    oLink="File:///[driveletter]:/[share]/[folder]/" & strCandidateString & ".pdf"
    oLink=cStr(oLink)
    ShellRun.Run oLink

    Thanks again!

    jen

Posting Permissions

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