Solved

Error Continue in Excel VBA

Posted on 2007-11-20
2
944 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
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 500 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

758 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

18 Experts available now in Live!

Get 1:1 Help Now