473,385 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Error handling on hyperlinks to folders (VBA)

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.FollowHyperlink link.Text

End If

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


End Sub
Feb 21 '17 #1

✓ answered by hlumpkins10

I have determined my problem. The options need to be set to "break in class module"

1 2586
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
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...
10
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...
21
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...
33
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...
10
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...
35
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...
0
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...
5
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...
5
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...
5
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.