Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Error Continue in Excel VBA

Posted on 2007-11-20
2
Medium Priority
?
966 Views
Last Modified: 2008-02-01
This is Excel 2003.
I have this “File” that I have linked to and I need to save every 13 seconds to keep it live.  

But sometimes the original file is saving and my procedure errors out.   How do you tell it to   “ If  error then continue” without popping up the error, so I don’t have to manually do it.

Any help would greatly be appreciated.
'//////////////////////////////////////////////////////////
Sub UpdateLinks()'

    ActiveWorkbook.UpdateLink Name:= _
        "\\DTCNAS-ILSP002\Test.xls" _
        , Type:=xlExcelLinks
    Range("A1").Select
   
    Call UpdateTime
End Sub


Sub UpdateTime()

Application.OnTime Now + TimeValue("00:00:13"), "UpdateLinks"

End Sub
0
Comment
Question by:ca1358
[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
2 Comments
 
LVL 13

Expert Comment

by:Michael_D
ID: 20322464
Try this


Sub UpdateLinks()'
 
On Error GoTo ErrorHandler
 
    ActiveWorkbook.UpdateLink Name:= _
        "\\DTCNAS-ILSP002\Test.xls" _
        , Type:=xlExcelLinks
    Range("A1").Select
   
    Call UpdateTime
ErrorHandler:
    ' Do whatever want to do if error occures
End Sub

Open in new window

0
 
LVL 17

Accepted Solution

by:
Shanmuga Sundaram earned 2000 total points
ID: 20402000
Though using "On Error Resume Next" is not advicable during in need we can use them.

Sub UpdateLinks()'
On Error Resume Next
    ActiveWorkbook.UpdateLink Name:= _
        "\\DTCNAS-ILSP002\Test.xls" _
        , Type:=xlExcelLinks
    Range("A1").Select
   
    Call UpdateTime
End Sub


Sub UpdateTime()
On Error Resume Next
Application.OnTime Now + TimeValue("00:00:13"), "UpdateLinks"
End Sub
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

730 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