+ Reply to Thread
Results 1 to 3 of 3

File status

  1. #1
    Francis Ang
    Guest

    File status

    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.

  2. #2
    AA2e72E
    Guest

    RE: 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.


  3. #3
    Francis Ang
    Guest

    File status

    Thank you very much for your help. I really appreciate it.


    "AA2e72E" wrote:

    > 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.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1