VBA - Can't “Check In” uploaded document on SharePoint

Copper Contributor

i have a VBA code that uploads new document on SharePoint. It uploads new row on sharepoint, but it doesn't start a workflow for new item, because it needs to be "Checked In". When i do it manually - i click Upload, choose a file, fill up required fields, and after that i press "Check In" which add new item to the sharepoint and automatically starts a workflow. When i do it by VBA - it adds new item with described fields, but it doesn't start a workflow because it needs "Check In" yet.

I've tried with codes like that from official documentation of Microsoft

Sub CheckInOut(strWkbCheckIn As String)

' Determine if workbook can be checked in.
If Workbooks(strWkbCheckIn).CanCheckIn = True Then
Workbooks(strWkbCheckIn).CheckIn
MsgBox strWkbCheckIn & " has been checked in."
Else
MsgBox "This file cannot be checked in " & _
"at this time. Please try again later."
End If

End Sub
i think when i open a workbook - it's only in read-only mode so i can't use there "Check In" method. Manually i can do it without any problem on SharePoint Site.

0 Replies