Buongiorno a tutti! c'è qualcuno che sa dirmi come verificare se un file è aperto o no in Visual Basic 6?
Ciao e grazie!![]()
Buongiorno a tutti! c'è qualcuno che sa dirmi come verificare se un file è aperto o no in Visual Basic 6?
Ciao e grazie!![]()
Ciao !
Scusa, quale tipo di file ?
Se è un DB, p.es. di Access, puoi testare una proprietà. P.es:
dim Tabella as Recordset
On Error resume next
debug.print Tabella.name
if err=91 then
'tabella non aperta
endif
on error goto 0
Se è un recordset con connessione ADO basta testare la proprietà .State:
se è uguale a adStateOpen significa che il recordset è aperto
Se è un file sequenziale:
on error resume next
open "c:\temp\qqq.log" for output as #1
if err=55 then
'file già aperto
endif
on error goto 0
Sicuramente esistono dei metodi più "puliti", ma non li conosco.....
Vero non ho specificato il tipo un file di testo normalissimo as esempio .txt
Ciao e grazie per la risposta![]()