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

%3CLINGO-SUB%20id%3D%22lingo-sub-2083114%22%20slang%3D%22en-US%22%3EVBA%20-%20Can't%20%E2%80%9CCheck%20In%E2%80%9D%20uploaded%20document%20on%20SharePoint%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2083114%22%20slang%3D%22en-US%22%3E%3CP%3Ei%20have%20a%20VBA%20code%20that%20uploads%20new%20document%20on%20SharePoint.%20It%20uploads%20new%20row%20on%20sharepoint%2C%20but%20it%20doesn't%20start%20a%20workflow%20for%20new%20item%2C%20because%20it%20needs%20to%20be%20%22Checked%20In%22.%20When%20i%20do%20it%20manually%20-%20i%20click%20Upload%2C%20choose%20a%20file%2C%20fill%20up%20required%20fields%3CA%20href%3D%22https%3A%2F%2Fexonlinecalculator.com%2Fvat-numbers-uk%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%2C%3C%2FA%3E%20and%20after%20that%20i%20press%20%22Check%20In%22%20which%20add%20new%20item%20to%20the%20sharepoint%20and%20automatically%20starts%20a%20workflow.%20When%20i%20do%20it%20by%20VBA%20-%20it%20adds%20new%20item%20with%20described%20fields%2C%20but%20it%20doesn't%20start%20a%20workflow%20because%20it%20needs%20%22Check%20In%22%20yet.%3C%2FP%3E%3CP%3EI've%20tried%20with%20codes%20like%20that%20from%20official%20documentation%20of%20Microsoft%3C%2FP%3E%3CP%3ESub%20CheckInOut(strWkbCheckIn%20As%20String)%3CBR%20%2F%3E%3CBR%20%2F%3E'%20Determine%20if%20workbook%20can%20be%20checked%20in.%3CBR%20%2F%3EIf%20Workbooks(strWkbCheckIn).CanCheckIn%20%3D%20True%20Then%3CBR%20%2F%3EWorkbooks(strWkbCheckIn).CheckIn%3CBR%20%2F%3EMsgBox%20strWkbCheckIn%20%26amp%3B%20%22%20has%20been%20checked%20in.%22%3CBR%20%2F%3EElse%3CBR%20%2F%3EMsgBox%20%22This%20file%20cannot%20be%20checked%20in%20%22%20%26amp%3B%20_%3CBR%20%2F%3E%22at%20this%20time.%20Please%20try%20again%20later.%22%3CBR%20%2F%3EEnd%20If%3CBR%20%2F%3E%3CBR%20%2F%3EEnd%20Sub%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fexonlinecalculator.com%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ei%20think%3C%2FA%3E%20when%20i%20open%20a%20workbook%20-%20it's%20only%20in%20read-only%20mode%20so%20i%20can't%20use%20there%20%22Check%20In%22%20method.%20Manually%20i%20can%20do%20it%20without%20any%20problem%20on%20SharePoint%20Site.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2083114%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional 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