ZTree.com  | ZEN  | About...  

 Index   Back

[OT] Batch file to check if file is open   [OT]

By: Martijn Coppoolse   Homepage   Voorburg, NL  
Date: Feb 14,2014 at 09:20
In Response to: [OT] Batch file to check if file is open (Neil Clough)

> Basically what I want to do is see if a "Read-Only" Excel file has
> been loaded.
>
> I don't need to write to it, I load it to call a macro in it.

What are you trying to accomplish here? It sounds like your macro requires the workbook to be opened as being writable. If so, why not check that within the macro itself, rather than from an external batch file?

If you really need to check this from a batch file: would the Excel file be opened on the same machine as where you run the batch file from? Because then you could use a VBScript or JScript file to connect to Excel, find the relevant Excel-workbook object, and test if it's been opened as read-only.


Excel (and most MS Office products) handles the opening and closing of files in quite a peculiar fashion. While an Excel file is open, its last-modified-date is set to today, but after closing it (without making changes), the last-modified-date is restored to its value before the file was opened.


--
Martijn

1,881 views      
Thread locked
 

Messages in this Thread

 
96,637 Postings in 12,231 Threads, 350 registered users, 61 users online (0 registered, 61 guests)
Index | Admin contact |   Forum Time: Mar 28, 2024 - 9:45 pm UTC  |  Hits:62,381,339  (33,736 Today )
RSS Feed