I have VBA code that uploads a 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 required fields, and after that I press "Check In" which adds new item 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".
I 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
When I open a workbook it's in read-only mode so I can't use the "Check In" method.