如何在sharepoint上签入文件?

问题描述 投票:1回答:1

我已经编写了以下代码,用于通过Sharepoint上的VBA签入文件。

Dim strWkbCheckIn As String

strWkbCheckIn = spBASE_URL + spDOC_LIB + "/" + spFILE_NAME

' Determine if workbook can be checked in.
If Workbooks(strWkbCheckIn).CanCheckIn = True Then
   Workbooks(strWkbCheckIn).CheckIn
   MsgBox ("checked in.")
Else
   MsgBox ("This file cannot be checked in ")
End If

但它显示以下错误:

Run-time error '9':
Subscript out of range

我已经检查过该文件确实存在于sharepoint上。但仍然得到这个错误。只是一个疯狂的猜测,是否有可能,因为文件和签出给我,它是不可见的程序?

vba sharepoint checkin
1个回答
1
投票

这应该为你做。

Sub testing()
    Dim docCheckOut As String
    'docCheckOut = "//office.bt.com/sites/Training/Design Admin/Training Plan/adamsmacro.xlsm"
    docCheckOut = "http://excel-pc:43231/Shared Documents/ExcelList.xlsb"
    Call UseCheckOut(docCheckOut)
    Call UseCheckIn(docCheckIn)
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

Sub UseCheckIn(docCheckIn As String)
     ' Determine if workbook can be checked out.
    If Workbooks.CanCheckIn(docCheckIn) = True Then
        Workbooks.CheckIn docCheckIn
    Else
        MsgBox "Unable to check in this document at this time."
    End If
End Sub
© www.soinside.com 2019 - 2024. All rights reserved.