OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Add a hyperlink in a User form (http://forum.oberonplace.com/showthread.php?t=7121)

PAnderson 15-08-2010 14:44

Add a hyperlink in a User form
 
How do I make a hyperlink for a text label on a user form? I have done this several times on forms, but my link does not seem to be working in Windows 7. It returns a Compile Error and says "Sub or Function not defined."

What am I missing?

Code:

Private Sub label_weblink_Click()

ShellExecute 0, "Open", "http://www.websitelink.com/", "", "", vbNormal

End Sub

Patti

runflacruiser 15-08-2010 15:09

Hi.

You'll need to put this at the top of the module.

Code:

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
-John

PAnderson 15-08-2010 16:09

That did it! Thanks, John!

I don't remember adding that code at the top before with some of my older macros (which doesn't mean it wasn't supposed to be there!). At the risk of asking a dumb question...Is that standard or something new?

This is the kind of stuff I just don't know about not having any background in VBA other than books and the help that comes with CD. :confused:

Patti

runflacruiser 15-08-2010 17:32

Hi.
It was probably there and you didn't notice. It basically just tells the macro where to find the function since this isn't a standard vba function. Windows functions are stored in .dlls so it refers to shell32.dll to find it.

-John

PAnderson 15-08-2010 19:54

Thanks again, John! This is the kind of info I'll definitely be adding to by notes.

Patti


All times are GMT -5. The time now is 12:58.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com