+ Reply to Thread
Results 1 to 2 of 2

Upload to sharepoint

  1. #1
    Lp12
    Guest

    Upload to sharepoint

    Hi all,
    Im trying to found the proper code for saving a file with VBA to a document
    library in Sharepoint.
    Thanks in advance,
    Assaf

  2. #2
    dalejrstwin
    Guest

    RE: Upload to sharepoint

    here is what I'm look to do.. this works, but also fails if a user is not
    logged into the Sharepoint server.

    ' Determine if workbook can be checked out.
    On Error GoTo ErrorHandler
    'Fails if User not Logged into Sharepoint
    If Workbooks.CanCheckOut(Filename:=savename) = True Then
    Workbooks.CheckOut savename
    MsgBox "Checked out file from IntraShare: " & file
    End If

    'I actually don't need to open file
    'Workbooks.Open (savename)

    'Instead save over it.
    ActiveWorkbook.SaveAs Filename:=savename,
    FileFormat:=xlWorkbookNormal
    'Check it in -- works if I checked it Out

    If Workbooks(ActiveWorkbook.Name).CanCheckIn = True Then
    Workbooks(ActiveWorkbook.Name).CheckIn
    savechanges:=SaveDuringClose, Comments:="", MakePublic:=True
    MsgBox file & " has been checked in."
    Else
    MsgBox "This file cannot be checked in " & _
    "at this time. Please try again later, " & _
    "someone else who has write access could have it Checked
    Out."

    End If



    Else
    ErrorHandler:
    MsgBox ("You may need to log into Sharepoint Server for this process
    to work.")
    ActiveWorkbook.SaveAs Filename:=savename, FileFormat:=xlWorkbookNormal
    If Closefile = True Then ActiveWorkbook.Close
    savechanges:=SaveDuringClose
    End If

    Try this.. the path you might need is something like this:
    Public Const SharePointPath = "\\sharepoint.xxxxxx.com\sites\mysite\"
    The add your document library to the path after that.

    dalejrstwin

    "Lp12" wrote:

    > Hi all,
    > Im trying to found the proper code for saving a file with VBA to a document
    > library in Sharepoint.
    > Thanks in advance,
    > Assaf


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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