Solved

Inserting Hyperlinks using VBA

Posted on 2004-04-22
8
1,442 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Looking for a program that deletes all files of same size 18 59
How to run a VBS file in a MS access macro? 2 27
Ms Access VBA Variables 6 26
Create macro from runcode 30 22
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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…

813 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now