VBA Sharepoint Check out & Check in - Please help a newbie!!

Hi Folks

I have a problem! After being pointed in the direction of the Microsoft pages for assistance with Check out & Check in documents via VBA.

After some investigating and general searching I have managed to nearly get what I need but need asistance with the following

Please could someone advise how to change the following to apply to a number of other excel files on Sharepoint at the same time? i.e check out the file mentioned plus others named "Planning Team" for example

Sub test()
Dim docCheckOut As String
docCheckOut = "http://teamspace.intranet.group/site...I/Forcast Team.xls"
Call UseCheckOut(docCheckOut)
End Sub
Sub UseCheckOut(docCheckOut As String)
' Determine if workbook can be checked out.
If Workbooks.CanCheckOut(docCheckOut) = True Then
Workbooks.CheckOut docCheckOut
Else
MsgBox "Unable to check out this document at this time."
End If
End Sub

You've probably guessed the next question! What would the code be to then do the opposite i.e Check all the files back in (preferably bypassing the "do you need to add comments" pop up)

Many thanks as always!

Jamie

VBA Sharepoint Check out & Check in - Please help a newbie!!

Here is solution that works for me:

' updatefile is a flag to indicate whether to save the open file or just close it.
' dbWorkbook_fn is the name of the file that is open and checked out

If updatefile = True Then
dbWorkbook_fn = dbWorkbook & ".xlsx"
If Application.Workbooks(docCheckIn).CanCheckIn Then
'Check In, Save and Close
Application.Workbooks(dbWorkbook_fn).CheckIn SaveChanges:=True, Comments:=""

'Close the workbook
Workbooks(dbWorkbook_fn).Close

End If
Else
' Nothing to save so just close the file
dbWorkbook_fn = dbWorkbook & ".xlsx"
If Application.Workbooks(docCheckIn).CanCheckIn Then
Application.Workbooks(dbWorkbook_fn).CheckIn SaveChanges:=False
Workbooks(dbWorkbook_fn).Close
End If
End If

Note that even though the CheckIn function checks in the file, it will not show as checked in in SharePoint until you close it, hence the Workbooks.Close command.

Hope this helps

Derek