VBA代码签出和签入共享点文档 [英] VBA code to checkout and checkin sharepoint document

查看:176
本文介绍了VBA代码签出和签入共享点文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个要求Excel 2007宏需要检出SharePoint网站上载的excel文档并需要检入的要求.我尝试使用下面的代码块,但代码无法检出文件.请提供您的反馈意见

Hello all,

I have an requirement where an Excel 2007 macro needs to check out an excel document uploaded on SharePoint site and needs to check In. I tried with the code block below but the code is not able to check out the file. Please give your feedbacks

Sub Macro1()
'
' Macro1 Macro
'
 
Dim xlApp As Excel.Application
Dim wbkReleaseFile As Workbook

    Dim strFilePath As String
    strFilePath = "" 'SharePOint URL 

    If Workbooks.CanCheckOut(strFilePath) = True Then
           Workbooks.CheckOut strFilePath
    Else
        MsgBox "Unable to check out this document at this time."
    End If
     
    Set wbkReleaseFile = Workbooks.Open(strFilePath, , False)
    
    wbkReleaseFile.Activate
    Sheets(1).Select
    Cells(4, 4).Value = "Modified"
    
    ' Determine if workbook can be checked in.
    If Workbooks(strFilePath).CanCheckIn = True Then
        Workbooks(strFilePath).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



从OP的答案移至:

我收到的错误消息是无法签出文件".文件路径正确.甚至我都尝试检查.xls和.xlsx都不起作用.



Moved from OP''s answer:

The error message that I get is "Not able to check out the file". The file path is correct. Even I tried to check out .xls and .xlsx both are not working.

推荐答案

您需要更具体一些.收到错误消息吗?如果是这样,那是什么错误?
You need to be more specific. Do you get an error? If so, what is the error?


这篇关于VBA代码签出和签入共享点文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆