Thread: File status
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AA2e72E AA2e72E is offline
external usenet poster
 
Posts: 400
Default File status

Declare Function lOpen Lib "kernel32" Alias "_lopen" (ByVal lpPathName As
String, ByVal iReadWrite As Long) As Long

Declare Function lClose Lib "kernel32" Alias "_lclose" (ByVal hFile As Long)
As Long

Status = lOpen "Your PDF FILE.PDF", & H10 ' open for read write

1. if Status is a a number greater than zero, the file is not in use,
otherwise, the file is in use.
2. if Status is 0, you will need to release it before you can use it:
lClose Status


"Francis Ang" wrote:

Hi,

From previous posts, I have seen how VBA code are written to determine
whether an Excel Workbook is opened. How to you write the VBA codes to
determine non-Excel file is opened say a PDF file opened with the 'Shell'
command?

Any help is very much appreciated.

Thank you.