![]() |
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. |
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. |
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. |
All times are GMT +1. The time now is 12:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com