title: vbscript to check in excel file
body: <p>I'm trying to write a vbscript to be able to checkout an excel file that is stored on sharepoint server.</p>
  
  <p>Currently I can check the file out from <a href="https://stackoverflow.com/questions/15000110/sharepoint-2010-link-to-open-excel-file-in-edit-mode-mode">SharePoint 2010: Link to open Excel file in edit-mode mode</a></p>
  
  <p>However, I'm trying to check the file back in but not able to.  I've searched and tried the checkout functions per <a href="http://msdn.microsoft.com/en-us/library/office/ff194456%28v=office.14%29.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/office/ff194456%28v=office.14%29.aspx</a> but not able to.</p>
  
  <p>Currently the code I have is</p>
  
  <pre><code>Sub CheckInFile
  
      Dim ExcelApp, ExcelSheet, ExcelBook
      Dim myURL
  
      myURL = "http://server/Site/excel.xlsx"
  
      Set ExcelApp = CreateObject("Excel.Application")                        
  
      If (ExcelApp.WorkBooks.CanCheckIn(myURL) = True) Then
          msgbox ("here")
          ExcelApp.WorkBooks.Open (myURL)
          ExcelApp.Application.WorkBooks.CheckIn myURL
  
          ExcelApp.ActiveWorkbook.Close
          ' Quit Excel.
          ExcelApp.Quit
          ' Clean Up
          Set ExcelApp= Nothing
      End If
  
  End Sub
  </code></pre>
  
  <p>However the script stops and fails at the if statement, rather doesn't execute.  Is there a similar vbscript function to check in a file ?</p>