Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Noa Noa is offline
external usenet poster
 
Posts: 11
Default How do I check error result occurring by filecopy function in VBA

I writing in VBA for excell.
My program calls the filecopy function in a private function. If filecopy
fails, the program should analyze it and return with a failure value to the
main subrotine that calld the fuction (in a success execution of filecopy,
the function returns the workbook object of the new destination file). How
can I check the status of the execution?
How can I found out if the returnd workbook object has value or it's empty?
Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default How do I check error result occurring by filecopy function in VBA

Hi
I tend to do something like

Err.clear 'err is not destroyed when the sub ends
On Error Resume Next
'do the copy
If err.number<0 then
'an error has occurred so do something
Else
'do something else
end if
On Error Goto 0

You could also capture the error number using Err.Number if you want
to do something with it.

regards
Paul
On May 11, 9:23*am, Noa wrote:
I writing in VBA for excell.
My program calls the filecopy function in a private function. If filecopy
fails, the program should analyze it and return with a failure value to the
main subrotine that calld the fuction (in a success execution of filecopy,
the function returns the workbook object of the new destination file). How
can I check the status of the execution?
How can I found out if the returnd workbook object has value or it's empty?
Thanks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Object Library Invalid" Error occurring...why? [email protected] Excel Programming 1 July 28th 08 08:30 PM
#Name? Error in place of function result Larry Serflaten Excel Programming 3 May 21st 07 07:27 PM
FileCopy Error 52 simon Excel Programming 0 February 28th 07 05:33 PM
FileCopy error Chip Pearson Excel Programming 0 August 1st 03 02:43 PM


All times are GMT +1. The time now is 10:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"