【问题标题】:How to check-in a file on sharepoint?如何在sharepoint上签入文件?
【发布时间】:2019-01-07 10:40:45
【问题描述】:

我已经编写了以下代码,用于通过 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

我已经检查过共享点上确实存在该文件。但仍然收到此错误。只是一个疯狂的猜测,有没有可能,因为文件和检出给我,它对程序不可见?

【问题讨论】:

    标签: vba sharepoint checkin


    【解决方案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
    

    【讨论】:

    • 这个工作需要哪些参考资料? CanCheckIn 通常不是工作簿方法....
    猜你喜欢
    • 2021-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-05
    • 1970-01-01
    • 1970-01-01
    • 2021-08-29
    相关资源
    最近更新 更多