I am trying to get the following code to work when I transfer the file from the server into SharePoint. The main workbook checks to see if the second workbook is read only before processing the rest of the code. If it is read only it tells the user they cannot continue and closes the second workbook. I am having trouble getting it to do the same in SharePoint.

Code works on server
strFile = "https://sharepointonline/site/Library/File.xlsx"
 
Set xNewWB = xNewApp.Workbooks.Open(strFile, Password:="dstmfg")
    xNewWB.Activate
        If xNewWB.ReadOnly Then
            MsgBox "The Custom Panel Log is Read Only. You cannot Assign Panel Numbers"
            xNewWB.Close
        Exit Sub
        Else
        'Do Nothing and Continue
        End If

         Code to Run

xNewWB.Save
xNewWB.Close
I found info that Read Only does not work In SharePoint so I have tried variations of trying to check if it can be checked out and checking it out but it wont check out.

strFile = "https://sharepointonline/site/Library/File.xlsx"
 
Set xNewWB = xNewApp.Workbooks.Open(strFile, Password:="dstmfg")
    xNewWB.Activate
        If Workbooks("xNewWB").CanCheckOut = True Then
            Workbooks("xNewWB").CheckOut
        Else
            MsgBox "The Custom Panel Log is Read Only. You cannot Assign Panel Numbers"
            xNewWB.Close
            Exit Sub
         End If     

             Code to run

    If Workbooks("xNewWB").CanCheckIn = True Then
    Workbooks("xNewWB").CheckIn SaveChanges:=True, Comments:="Panel Numbers for & Ws1.Range(JOB).Value"
        xNewWB.Close
    Else
    MsgBox "File not checked Out"
    xNewWB.Close
    Exit Sub
    End If
The code runs through without errors but hangs up and says that excel is waiting for another application to complete on OLE action causing me to use Task Manager and stop the process. When I open the second file, I see that it was never checked out so I am assuming it hangs up there. I can modify the files to make them small enough to attach if someone needs to see them to help out.