|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Error Routine
Hi,
I have this code where i want to track errors if file does not open or if the refreshall does not work. How do i handle my error using on error goto function? Excel.Application.Workbooks.Open "C:\flextest\iman1_all.xls" Excel.Application.Visible = True Worksheets(1).Select Excel.Application.DisplayAlerts = False Excel.ActiveWorkbook.RefreshAll Sheets("Chart1").Select Excel.ActiveWorkbook.Save Excel.ActiveWorkbook.Close Thanks, Rakshan
__________________
raks |
|
#2
|
|||
|
|||
|
I'm not sure how to get an error back from another application.
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
What i want to do is write out a log to a text file if the xls file does not open or if the refresh command fails. I want to just print a error line stating the file was unable to open or refresh failed to a log.txt file.
Thanks, Rakshan. |
|
#4
|
|||
|
|||
|
Well, general syntax for handling errors goes something like this:
On Error Go To HandleErrors 'Your Code HandleErrors: 'Your handling code The Err object should catch the types of errors that you are describing, however, I am not sure exactly how it works through OLE Automation. I actually catch errors from other programs not being controlled through VB you'll need to use a Window's API function to watch for such events. But exactly which one, I'm not entirely sure. I hope this helps! |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Error Routine |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
![]() |
|