Label click not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I tried using the code below to access hyperlinks, but it's not working, but
this is my first attempt with coding in Outlook. I put the code in VBScript,
which seemed to only way to attach it to the form. What am I doing wrong?

Sub lblPDS_Click()
Set objWeb = CreateObject("InternetExplorer.Application")
objWeb.Navigate Item.GetInspector.ModifiedFormPages _
("Approval").Controls("lblPDS").Caption
objWeb.Visible = True
End Sub
 
Thanks, Sue. I did not know that. Also, I just found the Click event table
for Outlook. I have another problem as well, my label is bound. The
hyperlink is a field in one portion of the form. I guess I will have to find
another way to do this. I want a user to fill his hyperlinks, then on a
second page, let the recipient click on the hyperlink to view the
information. Have any ideas?
 
You can't get a Click event on a bound control. You'll need to either unbind
the label or provide a separate command button to run the code.

If you unbind the label, you can use the CustomPropertyChange event to set
the label's caption. See http://www.outlookcode.com/d/propsyntax.htm

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Thanks, Sue. Your comments are spot on target. One more thing. The
hyperlinks are documents created in either Excel, Word, PowerPoint or Visio.
Is there a way that I can ask Windows to open the file for me when a user
clicks on the label? Otherwise, I will have to parse the hyperlink string,
not difficult, but Windows already has this established, if I can access it.
 
You can run any program or file with a Shell command:

Set Myshell = CreateObject("WScript.Shell") 'Windows Scripting Host
Object
Myshell.Run "C:\myfile.doc" 'Execute program
 
Sue, thank you so much. I found the GetObject, but didn't know about the
code you did below. I have tried it and it works a treat! Thanks again.
 
Back
Top