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
Solved

Inserting Hyperlinks using VBA

Posted on 2004-04-22
8
1,450 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Spell checker for VBA 4 29
VBA modules import 4 57
Compile Error - Argument not optional - MS Access - VBA - Adobe Acrobat 2 26
Access/Visual Basic Question 3 24
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

856 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