>Hi,
>
>I have an app that allows users to export transactions to an excel spreadsheet. If they try to export the transactions to an Excel file that is currenly open, the following error occurs:
>
>Error # 1426
>OLE Error Code 0x80030021: A lock violation has occurred.
>
>I have a global error handler that traps and deals with certain 'common' errors. Can anyone give me pointers on dealing with specific OLE errors - such as this one. I'd like to trap this error and advise the user that the spreadsheet must be closed before exporting the transactions (if they are using the same spreadsheet name). Any assistance would be appreciated. TIA
I am working with AutoCad 2000 through ActiveX and have not found any way to funnel error messages thru to VFP.
I try to open the file thru the low level fopen and duck it if it is being used, passing the message to my user. The chance I take is that the file will be opened by someone else during the milliseconds between fclose and opening it in the app (AutoCad). Below is the simple function.
function IsFileLocked
lParameter tcFileName
local lnHandle,lReturn
* let's see if it is being used
lnHandle = fopen(tcFileName,12)
if lnHandle = -1
return .t.
endif
= fclose(lnHandle)
return .f.
Hope it helps.
Best Regards
Don Simpson