Label click not working

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
 
S

Sue Mosher [MVP-Outlook]

Did you publish the form? Code doesn't run on unpublished forms.
 
G

Guest

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?
 
S

Sue Mosher [MVP-Outlook]

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
 
G

Guest

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.
 
S

Sue Mosher [MVP-Outlook]

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Link in label tag work working 3
Hyperlink in Outlook form v2 5
SueHelpMe 1
using a command button to operate a hyperlink 5
open file 8
navigate 1
Print from IE 3
URL's in Custom Forms 1

Top