If you write a VBA macros in workbook which works differently in locked and in unlocked file, function IsWorkbookLocked can be used to determine if some workbook is locked.
LockXLSRuntime.IsWorkbookLocked( < workbook object > As Excel.Workbook ) As Boolean
workbook object is an object which represents workbook you want to check. This is not a workbook name!
Be careful if you are using Workbooks("WorkbookName") statement to get Workbook object. If workbook with this name is not opened, you will get "Subscript is out of range" error.