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

0
Utf
5/11/2010 8:23:01 AM
excel.programming 6508 articles. 2 followers. Follow

1 Replies
3491 Views

Similar Articles

[PageSpeed] 35

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=A0am, Noa <N...@discussions.microsoft.com> 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 t=
he
> main subrotine that calld the fuction (in a success execution of filecopy=
,
> the function returns the workbook object of the new destination file). Ho=
w
> can I check the status of the execution?
> How can I found out if the returnd workbook object has value or it's empt=
y?
> Thanks

0
Paul
5/11/2010 9:01:09 AM
Reply:

Similar Artilces:

Function to return path to current mdb
There must be a function or property to return path/mdb name. Here ya go: Function CurrentDBDir() As String Dim strDB As String, strCurrentDir As String strDB = CurrentDb.Name strCurrentDir = Left(strDB, Len(strDB) - Len(Dir(strDB))) CurrentDBDir = strCurrentDir End Function HTH, -- Mark Andrews RPT Software http://www.rptsoftware.com http://www.donationmanagementsoftware.com "JimP" <jpockmire@att.net> wrote in message news:nqKdna8-wtakiFPWnZ2dnUVZ_g6dnZ2d@giganews.com... > There must be a function or property to return path/mdb name. >...

Error
Using Money 3.0 on XP get an entry when trying to balance account. In the interest and service charge field - ACL<402C> appears. How can I correct this? Search newsgroup microsoft.public.money for "ACL<402C>" at http://groups.google.com; this has been discussed before, but I don't recall the specifics. <anonymous@discussions.microsoft.com> wrote in message news:0d6601c3d589$9d15bff0$a001280a@phx.gbl... > Using Money 3.0 on XP get an entry when trying to balance > account. In the interest and service charge field - ACL<402C> > appears. How can...

Workflow monitor error log
Hi, I have an oppor sales process that is active in workflow I have a create rule which picks the right workflow, which is also active. I create an opportunity but never see the sale process. When I check the workflow error log, I see Error code - 80045f01 Value cannot be null Paramater Name: Please provide the web service url Any ideas? Paul -- Paul Doyon CRM Consultant Are you running any custom assemblies? -- Robert MacLean http://www.sadev.co.za "Paul" wrote: > Hi, > > I have an oppor sales process that is active in workflow > I have a create rule w...

AP Check written amount missing dollars and cents
Since the GP 8.0 year end update, the AP check format has the written amount field missing the "Dollars" and "Cents" parts. Has anyone else encountered this? ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolution...

Query Parameters error of the Upsized database
I have upsized my Access 2007 database to SQL server 2005 database (Front end Access Database and Back end SQL server Database). Following Adp query does not work as Accdb query after upsized the database due to parameters have been changed. Therefore, please help me to solve the problem. Accdb Query SELECT * FROM DONATIONS WHERE (((DONATIONS.PAY_DATE)>=[forms]![report].[STR_DATE] And (DONATIONS.PAY_DATE)<=[forms]![report].[END_DATE])); Adp Query(After upsized) SELECT dbo.DONATIONS.* FROM dbo.DONATIONS WHERE (PAY_DATE >= @forms___report___STR_DA...

Debit Card Error
We are running RMS 2.0 and just setup Chase as our Preferred Processor, we can successfully process and settle credit cards. During the installation of preferred credit card our v number was 8 digits (1) alpha, and (7) numeric. RMS requires 8 numberic, so we removed the V and added "1" to the end (Chase recommended we do this). Could this be why debit cards do not process - We have setup the tender type for debit, we are using Verifone 1000se pin pads with facotry settings, and can successfully test the pin pad. During a Debit transaction, we can verify the amount, and ent...

Excel error and closure upon opening
This morning, I used Excel 2000 without any problems. This afternoon, I cannot open it. Every time I try, I get the following error: "EXCEL.exe has generated errors and will be closed by Windows. You will need to restart the program. An error log is being created." Rebooting does not fix the problem. Shutting down and restarting does not fix the problem. It appears that there have been a flurry of similar complaints on the message board today. Does anyone have any ideas on how to fix this? Open it on someone else's PC with a different version (newer, I guess of Exc...

Run-time Error 424
When the spreadsheet in local, on my HD, all is well. When I put the spreadsheet on the server, I get this error. Any ideas? It's driving me nuts. The ironic thing ... it use to work just fine. Some PC's I email the file to it works, other don't Thanks for your help!! The quick search I did indicated Error 424 appears with the message "Object required". Is it possible the code reads from or writes to a file on a specific drive? That would explain why some machines generate the error and others do not. For instance, if the code says "read from a file on th...

Chart sizes with window frame check box is frozen in the 'ON' STAT
Sorry about the subject typo on the first post. Message repeated below I am running Excel 2000 under Windows XP on my laptop. Under the Tools:Options menu on the Chart tab, there is a check box labeled "Chart sizes with window frame". The box is checked. If I uncheck the box the check mark disappears, but when I click 'OK', nothing happens to the chart and the zoom control in the toolbar does not activate. When I open the Tools:Options menu again, the check mark reappears. It will not turn off. I have tried uninstalling and reinstalling with no effect. I have c...

Custom function returning VALUE error
Hi, I am trying to construct a simple function to calculate distance between 2 points on Carthesian plane. The function I wrote: Function FieldsXY(startx, starty, endx, endy) FieldsXY = Application.SQRT((endx - startx) ^ 2 + (endy - starty) ^ 2) End Function The only result I'm getting is #VALUE! error. I tried to declare all arguments as integer, didn't help. Help would be greatly appreciated, as I'm no expert in this :). regards, Alex -- alex.k ------------------------------------------------------------------------ alex.k's Profile: http://www.excelforum.com/member.p...

Outlook 2003 send/receive error (0x80040900)
Hi, I have a laptop running XP-Pro SP-2, Office 2003 SP-2, BCM SP-2, all updated. When I launch Outlook, it synchronizes the folder lists and the modem lights indicate traffic. When I press the send/receive button, I immediately receive this error message: "Task "Pipe and Tanks-Receiving' reported error (0x80040900).'The server name you entered cannot be found on the network (it might be down temporarily). Please verify that you are online and that the server name is correct.' " I have the Outlook Send/Receive Progress pinned. When I click on the "Cancel All&q...

Contains function
I'm trying to determine if data in one cell is contained in another cell. In the following example I would like to see if A1 is in B1 then "True" else "False". Is there any easy way to do this? Thanks! A B 1 Baez CN=Oscar Baez/OU=US/O=ABCDEFGH/C=NL True 2 Bailey CN=Eleanor Bailey/OU=US/O=ABCDEFGH/C=NL True 3 Smith CN=Makisha Baines/OU=US/O=ABCDEFGH/C=NL False 4 Jones CN=Karen Bajda/OU=US/O=ABCDEFGH/C=NL False 5 Baker CN=LeeAnn Baker/OU=US/O=ABCDEFGH/C=NL True Heres 1 way; =+IF(COUNTIF(B1,"*"&A1&"*")=1,"TRUE") I don't ...

unvoided checks
Is there any way to unvoid a check that you void in Purchasing-Void Historical Transactions?? ...

Sync errors #2
i have one user that's on outlook 2003, W2K Pro w/SP4, that's getting sync errors. i have removed and replaced the profile and still get these errors when using dialup. We have all updates for the operating system and office loaded. any suggestions? 1. 18:57:44 Synchronizer Version 11.0.5604 18:57:44 Could not connect to public folder server. 18:57:44 [8004011D-526-80040115-0] 18:57:44 The Microsoft Exchange Server computer is not available. Either there are network problems or the Microsoft Exchange Server computer is down for maintenance. (/O=CAST/OU=LosAngeles/c...

Getting a Runtime error
When importing a csv file into in Inventory wizard 140 Change Item Ordering Info. I am getting Run-time Error"-2147217900(80040e14)': Incrrect syntax near 'WHE" When I click on OK it closes the Store Operations Manager Anyone have any ideas on how to fix this hi sherie, tell me the format of your file , what fields you are using. "Sherie" wrote: > When importing a csv file into in Inventory wizard 140 Change Item Ordering > Info. I am getting Run-time Error"-2147217900(80040e14)': Incrrect syntax > near 'WHE" > When I...

Error Registering table
While ruffling through Collection Main review,we are confronted with an error called "Error Registering table[Not Found]....Along with CreditCardAdvantage installed, Cash Receipts Entry and Receivables Batch Entry appear to be customized. The final error we get is Unhandled script exception : illegal address for field "Company name" in script "exitDynamics". Script terminated. If anyone can shed light on this it would be great TIA, AC Chances are that one of your custom forms is corrupt. If you go to Tools->Customize->Customization Status and Disable t...

SetFocus on a different sheet in VBA
In my workbook, I have 2 worksheets. Sheet2 contains the raw data. Sheet1 is a summary level of the raw data containing many calculations, formatting, etc. I have VBA code that populates sheet2 with data from an external source on the Workbook_Open event. The last thing I want to do after populating the sheet is to set focus (or activate?) a different worksheet, in this case, sheet1. Can anyone tell me how to accompish this? I have searched Help till I'm blue in the face and can't think any more possible keywords. Any help is appreciated! Thanks! -- AaronC --------------------...

Can use macro to check the size of Exchange mail box ??
I want to write a VBA or marco to check the size of mail box, include inbox outbox & deleted item, which locate on Exchange server. Can any info or ref. that I can read ?? Thank you very much. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ That information isn't available using the Outlook object model. You'd have to use CDO or Extended MAPI (C++ or Delphi only). Using CDO code the property tag you'd want to look at would be PR_MESSAGE_SIZE (0x0E0800...

testing for errors
woI am comparing amounts in tow fields:Billing Difference: IIf([SumOfAmt]>[AmountEst],[AmountEst]-[SumOfAmt]), which gave a lots of empty fields and one field shows 0.00. My second step is to show only the fields which: is not null or <>0. This one line showed still up even thought it should not. SumofAmt and AmountEst are identical. There are no fractions. Why would access think that these 2 amounts do not equal zero, even though it shows zero? If I format the difference field as General Number it returns: -1.45519152283669E-11 That works out to -0.0000000000145519152283669 ...

Check who didn't get the email in DL
I have created a DL on the server called Officials, a user sent out an email to this DL using OL2003. Can anyone tell me where I can check to see who in the DL didn't receive the message? This is the message that the sender is getting; Your message did not reach some or all of the intended recipients. Subject: Public Records Officers Sent: 1/3/2007 2:52 PM The following recipient(s) could not be reached: 'Officials' on 1/3/2007 2:52 PM The e-mail account does not exist at the organization this message was sent to. Check the e-mail address, or contact the recipient directly...

MSCRMAddressBook Error 6408
When navigating through the pages of Contacts I get an error upon reaching the 19th page? Source: MSCRMAddressBook Event: 6408 Description: An error occurred in the Microsoft CRM Address Book. Restart Microsoft Outlook and try again. HR=0xc00cee2b. Context= XML document parsing error lErrorCode 0xc00cee2b lFilePos 0 lLine 1 lLinePos 1 bstrReason Illegal xml character. bstrUrl .. Function=LogXmlError. Line=368. The CRM screen says the Grid Refresh Failed. Does this have something to do with database synchronization or indexing? I was working in the web i...

My outlook will not do spell check.
I have not been able to use the in program speel check for outlook express, since I loaded XP. What do I need to do to make it work? You will need a MS program like word. There is no Spell check in Outlook Express "Philip Wheeler" <pwheeler@surewest.net> wrote in message news:00d401c3552e$342ac2a0$a401280a@phx.gbl... > I have not been able to use the in program speel check > for outlook express, since I loaded XP. What do I need > to do to make it work? ...

Controlling size of check boxes and Combo Box font
How do you control the size of the little boxes in the check box option? Also, how do you control the font of the items in the combo box list? Thanks! As answered at previous question: You can change the font size in a combo box or check box from the Control toolbox, by switching to Design view, opening the Properties window, and changing the Font properties. If you've use the combo box or check box from the Forms toolbar, you can't change the font size. Someone wrote: > How do you control the size of the little boxes in the check box option? > > Also, how do y...

countif function #3
Hi, Would need your help with one issue. I want to count the all numbers between a range. I have used for instance this following formula =COUNTIF(O$5:O$104;">="&200) It gives me how many of my cells contain a number over 200. How would I do if I want to count cells between for instance 100 and 200? Using some IF and AND operators? Thank you so much in advance. best regards, Mark Mark, Two ways =COUNTIF(O$5:O$104;">=200")-COUNTIF(O$5:O$104;">=100") or =SUMPRODUCT((O$5:O$104;">=200")*(O$5:O$104;"<100")) -- HTH ...

Tally occurences of phrase on one sheet.
I have several sheets of information. What I'm looking to do is tally the occurences of a specific phrase "ABC" in one column, and place that tally on a separate sheet. Anyone have any ideas. The following code assumes that the data starts in column A, row 1 on a worksheet that is not Sheet3 and that the workbook has at least 3 worksheets. The macor is run while you are in the sheet containing the data you wish to count Sub CountABC() Dim varVal As Variant Dim lABCCount As Long Dim lOffset As Long Range("A1").Select varVal = ActiveCell...