+ Reply to Thread
Results 1 to 2 of 2

how do I open a version controlled spreadsheet on SharePoint?

Hybrid View

  1. #1
    Registered User
    Join Date
    05-08-2012
    Location
    Golden, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    77

    how do I open a version controlled spreadsheet on SharePoint?

    All,
    If I try to open an excel workbook on SharePoint from a Document Folder that does not have Version Control, it works fine.
    I am using this simple code:
    Public Const RESOURCE_FILE_LOCATION = _
        "http://path.to.real.file/filename.xlsx"
    Sub test()
        Dim msg As String
        On Error GoTo Oops:
        Workbooks.Open Filename:=RESOURCE_FILE_LOCATION
        On Error GoTo 0
        Exit Sub
    Oops:
        If Err.Number <> 0 Then
            msg = "Error # " & Str(Err.Number) & " was generated by " _
                & Err.Source & Chr(13) & "Error Line: " & Erl & Chr(13) & Err.Description
            MsgBox msg, , "Error", Err.HelpFile, Err.HelpContext
        End If
    End Sub
    However when I try to do it from a folder that has revision control, I get Error #1004. However the path does exist, the file is not being used by another program and I am not tying to save the workbook. If I click the file location in SharePoint, SharePoint asks me if I want to open the file as read only, or check the file out and edit it. For the purposes of my program, read only is fine.

    I have also tried adding Readonly:=True to the open line like this:
        Workbooks.Open Filename:=RESOURCE_FILE_LOCATION, ReadOnly:=True
    but that does not work either.
    Suggestions?
    Thanks

  2. #2
    Registered User
    Join Date
    05-08-2012
    Location
    Golden, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: how do I open a version controlled spreadsheet on SharePoint?

    I have not figured this out, but was able to find code on the web at MrExcel from Mav55th that allows one to make a local copy. that can then be opened and killed using the normal routines.
    Here is his code, and thanks to him who ever he is.
    Option Explicit
    
    Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
                                               "URLDownloadToFileA" ( _
                                               ByVal pCaller As Long, ByVal szURL As String, _
                                               ByVal szFileName As String, _
                                               ByVal dwReserved As Long, _
                                               ByVal lpfnCB As Long) As Long
    
    
    Sub DownloadFileFromWeb()
    Dim i As Integer
    
        Const strUrl As String = "http://teams/Dept/Shared Documents/Reports/Pivot_Source_Data/filename.csv"
        Dim strSavePath As String
        Dim returnValue As Long
        
        strSavePath = "C:\Reports\Pivot_Source_Data\xxxxxxxx.CSV"
        returnValue = URLDownloadToFile(0, strUrl, strSavePath, 0, 0)
        
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. save and close a spreadsheet by a controlled timer
    By Baz Kawar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-01-2013, 06:11 PM
  2. Creating a master spreadsheet based on various spreadsheet in Sharepoint
    By lmoura in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-06-2013, 05:09 PM
  3. [SOLVED] Open File Dialog to Sharepoint
    By newbie1234 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2012, 03:28 AM
  4. Importing spreadsheet into sharepoint
    By George Wilson in forum Excel General
    Replies: 0
    Last Post: 01-09-2006, 01:55 PM
  5. [SOLVED] Cant open SharePoint Lists
    By IT PHYTOSAN in forum Excel General
    Replies: 0
    Last Post: 08-02-2005, 08:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1