473,569 Members | 2,852 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error handling on hyperlinks to folders (VBA)

2 New Member
I have a macro button that will allow the user to open PDF's by inserting the PDF name. If the PDF does not exist, Excel crashes. I want to be able to handle the error, and give the user an output indicating the file doesn't exist.

Private Sub pdflink_Click()
'this button allows you to follow the text box with the location of the pdf.

On Error GoTo Error_handler
If link.Value = "" Then
MsgBox "There is no file selected!"
ElseIf link.Value = "Contact Engineering for PDF" Then
MsgBox "Please Contact Engineering for PDF"
Else

pdflink.Parent. Parent.FollowHy perlink link.Text

End If

Exit Sub
Error_handler: MsgBox "This file name does not exist."


End Sub
Feb 21 '17 #1
1 2594
hlumpkins10
2 New Member
I have determined my problem. The options need to be set to "break in class module"
Feb 22 '17 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3005
by: Steve Jorgensen | last post by:
When writing VB or VBA code that works with databases or other external libraries that cannot be trusted to automatically do the right thing when references to their objects are arbitrarily released, some thought must be put into how to make sure the objects will all be closed and released in the correct order, even in the result of an error....
10
605
by: David | last post by:
Hello I am trying to collect errors and record them in a table instead of a popup message stopping my code. It seems to work ok, but when I try to add ERR.Description to my code it fails on Syntax Error (missing operator). Any help would be very much appreciated Thanks Dave Dim strSql As String strSql = "INSERT INTO...
21
4385
by: Anthony England | last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled error is encountered, but it seems that this also happens when the variable is defined as private at form-level. So if "global variables get re-set" doesn't tell the whole story, then what does? ***please note*** I'm not looking for a solution - I'm looking for a...
33
3119
by: Anthony England | last post by:
I am considering general error handling routines and have written a sample function to look up an ID in a table. The function returns True if it can find the ID and create a recordset based on that ID, otherwise it returns false. **I am not looking for comments on the usefulness of this function - it is only to demonstrate error handling**...
10
2274
by: Anthony England | last post by:
(sorry for the likely repost, but it is still not showing on my news server and after that much typing, I don't want to lose it) I am considering general error handling routines and have written a sample function to look up an ID in a table. The function returns True if it can find the ID and create a recordset based on that ID, otherwise...
35
3746
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks gets about 3 or so. It also gets very awkward in nested loops, where you want to check for normal loop processing in the loop condition, not...
0
11561
by: Lysander | last post by:
Thought I would give something back with a few articles. This article is a bit of code to add error handling. When I have time, I want to write articles on multilingual databases, and Access Security, but I'll start with something short and simple This code was written in Access 2003 but should be valid in Access 2000 By default, when you...
5
1780
JodiPhillips
by: JodiPhillips | last post by:
Hello again, Its been a while since I've asked a question, I've been learning steadily reading the How To's and the questions in this forum, as well as reading my Access VBA and Access bibles till they are now in tatters!. I'm stuck with understanding the error handling process by VB6.5 (in particular for MSAccess 2003). The following...
5
14310
by: kellygreer1 | last post by:
I think I'm not quite understanding something about error handling in PHP5. I have written some PHP code to index the contents of C drive on a Windows machine. When it gets to certain special folders (fake folders) it runs into errors. Directories it can not read from. I have tried wrapping the code in a Try / Catch and the error still...
5
1905
by: sthorne | last post by:
Has anyone see an issue in an Access 2010 VBA procedure where the second time an error occurs it will return to the calling procedure? I have error handling enabled in a procedure and it works fine the first time around, but then the second time an error occurs it will exit the procedure and return to the calling proc. I have a routine that...
0
7619
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7930
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.