#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
reuest formula for auto update status & status date PERANISH Excel Worksheet Functions 5 June 2nd 08 04:26 PM
How do I clear read-only status on a workbook file? Karin Excel Discussion (Misc queries) 1 March 2nd 07 04:55 PM
Check file open status kaon[_18_] Excel Programming 4 July 19th 04 05:16 AM
Use file-status in IF ... THEN Jan V. Excel Programming 2 May 5th 04 09:12 AM
File Read-Only Status Nigel[_5_] Excel Programming 3 November 5th 03 05:38 PM


All times are GMT +1. The time now is 11:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"