Solved

Inserting Hyperlinks using VBA

Posted on 2004-04-22
8
1,460 Views
Last Modified: 2010-05-18
Hi all

I want a user to click a button which opens the hyperlink dialog box and then returns the hyperlink string when they're finished. I need a sample of vba code.

I've tried a few things and I have no idea how to open the hyperlink dialog box and the users want the standard one. Thanks in advance.

Cheers
STeve
0
Comment
Question by:sigs66
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 10887000
what do u mean, open the hyperlink dialog box?

0
 
LVL 2

Author Comment

by:sigs66
ID: 10887567
the dialog that comes up when you use the insert hyperlink or press control K
0
 
LVL 2

Author Comment

by:sigs66
ID: 10906481
Please help

Cheers
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 65

Expert Comment

by:rockiroads
ID: 10907247
Ive been having a look and quite find out to bring up this box
Ive not managed to find this hyperlink box
I will try to hep but you need to give me an example of where you insert a link so I can see what dialog you are talking about

I know you said user wants standard one but would you be open to alternatives? Try create a form similar to dialog if we cant get it to open

what do you want to do, prompt user for a hyperlink, they enter it? or pick one from a pre-defined list

0
 
LVL 2

Author Comment

by:sigs66
ID: 10910772
Hi

There is a table and one of the fields is a hyperlink field. The users open a form which displays relevant records from this table. When you click on the field you can get the insert hyperlink dialog by pressing control K, or  going to the insert menu and selecting the insert hyperlink, or right clicking on the field and selecting hyperlink, and then edit hyperlink.

I can create a custom form myself - I am familiar with the hyperlink object and vba coding but the users have been the standard dialog and want it. Recreating this particular form is quite complex. The standard dialog also lets you link to access forms and reports which is also used quite a lot.

Cheers Steve
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 10911026
ok, think Ive got it, after you telling me, I now know what you mean

setfocus to your hyperlink field
    HLink.SetFocus

Run the command to edit hyperlink
    DoCmd.RunCommand acCmdEditHyperlink


Its important you set the focus other edithyperlink command will fail

also you need to check return values, if Cancel hit, it returns a failure so you need to trap it
0
 
LVL 2

Author Comment

by:sigs66
ID: 10911171

DOHHHHHHHHH - Call me Homer J Simpson

I was looking for something complex and difficult and it's this simple. Thanks your help is much appreciated.

The error code is 2501 if you're interested.

Cheers
Steve
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 10911868
yea,it was easier than I thought as well
still Ive learnt summat new as well

take a look at RunCommand next time u want to do summat, theres loads of ops inthere

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question