Sunday, November 21, 2010

If I have an excel file open how can I write a VB program to tell me if the file is open ready only or write?

If I have an excel file open how can I write a VB program to tell me if the file is open ready only or write?If I have an excel file open how can I write a VB program to tell me if the file is open ready only or write?
This macro will display a message box advising whether the active workbook was opened 'Read Only' or not.



Copy this macro to the clipboard:



Sub Chk_Status()

If ActiveWorkbook.ReadOnly = True Then

MsgBox ';This workbook was opened 'Read Only'';

Else

MsgBox ';This workbook was not opened 'Read Only'';

End If

End Sub



Press ALT + F11



In the menus at the top of the VBE, select INSERT %26gt; MODULE



Paste the macro into the editing area to the right.



Close the VBE and return to Excel.



Press ALT + F8



When the Macros window opens, highlight the macro and click 'Options..'.



Enter a letter to use as a keyboard shortcut and click 'Ok'.



Close the Macros window and return to Excel.



Press CTRL + your letter to run the macro.
  • favorite musical groups
  • No comments:

    Post a Comment