I have a macro that will check in a document to SharePoint. If the document is opened as Read Only and the macro is run I get an error. Is there anything I can to only run that part of the macro if the document is checked out?

Thank you.