Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Access Denied problem
Message
De
28/09/2014 15:49:49
 
 
À
28/09/2014 15:24:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01608384
Message ID:
01608418
Vues:
32
>>>>>>I have a nice little Excel graph created using VFP code. It works great the first time. But the remaining Excel table won't allow VFP to overwrite the previous xls table produced using COPY TO. The message I get is 'Access Denied' when the overwrite is being attempted.
>>>>>>
>>>>>>Using VFP code, how do I get past the access denied situation and overwrite the old Excel table so the next chart may be produced?
>>>>>
>>>>>How did you create the first Excel file, using automation?
>>>>
>>>>I used the Visual FoxPro COPY TO command to copy a VFP table to an Excel xls file:
>>>>
>>>>Here is the code: COPY TO Graphtable TYPE XL5
>>>
>>>Normally after the copy command the XLS file is not in use, so you should not receive an Access denied error when you copy the second time over the same file. Unless another process opens that file in the meantime.
>>>Did you try to
>>>IF FILE("Graphtable.xls")
>>> ERASE Graphtable.xls
>>>ENDIF
>>>Before doing the copy?
>>>Also what might help, while you are getting the Access denied error, check which procedure locks the file. You can use a program like Unlocker to check which process is locking a certain file.
>>
>>This may be a better question to ask. The graphtable.xls file is READ ONLY. How do I change the graphtable.xls file's attribute to Normal using FoxPro Code?
>
>FUNCTION SetAttr
>PARAMETER tFileName, tAttribute
>tAttribute = UPPER(tAttribute)
>Private nAttribute
>nAttribute=0
>If 'S'$tAttribute && System
>   nAttribute = nAttribute + 4
>Endif    
>If 'H'$tAttribute && Hidden
>   nAttribute = nAttribute + 2
>Endif    
>If 'R'$tAttribute && ReadOnly
>   nAttribute = nAttribute + 1
>Endif    
>If 'A'$tAttribute && Archive
>   nAttribute = nAttribute + 32
>Endif    
>If 'N'$tAttribute && Normal
>   nAttribute = nAttribute + 128
>Endif    
>declare integer SetFileAttributes IN kernel32 STRING, INTEGER 
>Return SetFileAttributes(tFileName,nAttribute)=1
Thank you , young fellow. ;-)
I ain't skeert of nuttin eh?
Yikes! What was that?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform