Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
reuest formula for auto update status & status date | Excel Worksheet Functions | |||
How do I clear read-only status on a workbook file? | Excel Discussion (Misc queries) | |||
Check file open status | Excel Programming | |||
Use file-status in IF ... THEN | Excel Programming | |||
File Read-Only Status | Excel Programming |