Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
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  
Old July 7th, 2004, 02:58 PM
Rakshan Syed Rakshan Syed is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 44 Rakshan Syed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 48 sec
Reputation Power: 5
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

Reply With Quote
  #2  
Old July 7th, 2004, 06:11 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 18 h 51 m 25 sec
Reputation Power: 180
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

Reply With Quote
  #3  
Old July 8th, 2004, 11:22 AM
Rakshan Syed Rakshan Syed is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 44 Rakshan Syed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 48 sec
Reputation Power: 5
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.

Reply With Quote
  #4  
Old July 8th, 2004, 02:09 PM
spak111 spak111 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 349 spak111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 25 sec
Reputation Power: 5
Send a message via AIM to spak111
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!

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Error Routine


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway