Excel VBA to access sharepoint list without permission

Hi,
I do find solution to retrieve the SharePoint list from excel VBA but my problem now is on the SharePoint permission to the list.
I am developing this solution in excel because i don't want the particular user to access the list direct from the portal because the list contains some unique and confidential data. So what i did was created a new view in the portal with selected column
and i connect to the view from excel. So every time the user want to retrieve the data, he can run macro to refresh the data in the excel.
When i run the macro it can generate the list because i do have permission but if i run the same macro on the person machine, excel request for username and password because he don't have the permission to the list.
Are there any work around to allow the user to generate the data in excel without permission to the SharePoint list.
Thanks for the help.

I've done this before using SQL Server Reporting Services integrated into SharePoint.
Using SSRS, create the report you want the end user to view. Then create a Report Subscription, emailing the end user (or putting it in a file share/Doc Lib) the report. If they want to run it interactively, you can enable caching on the report, which would
pull the report from the last time it was scheduled to run (the data would not be 'real time' in this case).
Trevor Seward
Follow or contact me at...
&nbsp&nbsp
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

Similar Messages

  • How to access sharepoint List Data in Power Pivot model

    Hi,
    I have a sharepoint list and i want to access the list in power pivot workbook.
    I tryed exporting the list as datafeed but iam that is missing under export.
    Iam stuck pls help any other approach.?
    Regards,
    Krishnaa

    Hello,
    I have answered this question in this thread below:
    http://social.technet.microsoft.com/Forums/office/en-US/92a04e1b-a5f7-4dbe-88e7-0a1064622641/sharepoint-list-access-in-power-pivot?forum=sqlkjpowerpointforsharepoint
    Please go through the following aticles:
    Using SharePoint List Data in PowerPivot:
    http://msdn.microsoft.com/en-us/library/hh230322.aspx
    Using a SharePoint List as a data source:
    http://blogs.technet.com/b/excel_services__powerpivot_for_sharepoint_support_blog/archive/2013/07/11/excel-services-using-a-sharepoint-list-as-a-data-source.aspx
    Regards,
    Elvis Long
    TechNet Community Support

  • How to access Sharepoint List using a Different user. Access SharePoint List using some Authentication

    Hi,
    SharePoint version 2010
    I am building an application in Java and would want to accesss a SharePoint List through REST. I have been trying to find out how the authentication process would work once i want to deploy it into Production. 
    I am not able to find anything useful to send user detail / authentication. Can you please help me out here.
    Thanks,
    Bhaskar.
    Thanks, Bhaskar

    Hi,
    According to your post, my understanding is that you want to access SharePoint list from Java application through REST.
     In some cases you may need to create a new access token (this is somewhat akin to "running as a different user").
    Essentially, you are using a different user's security context. Typically, you would create an Active Directory account specifically for this purpose and then grant appropriate rights to the user account in SharePoint.
    http://sharepoint.stackexchange.com/questions/83440/authenticate-external-systems-against-sharepoint-rest-services
    There are some articles about this topic, you can have a look at them.
    http://stackoverflow.com/questions/10722215/authenticating-to-sharepoint-with-kerberos-from-a-java-httpclient
    http://ctp-ms.blogspot.com/2012/12/interoperability-between-java-and.html
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • Append excel sheet data to sharepoint list

    HI,
    I have an excel sheet and i have publshed this list on sharepoint 2010.
    Now i want to append some more records to the same list on sharepoint.
    So is it possible in sharepoint?
    Please help to solve the issue.
    Thanks & Regards
    Rajni

    Hi,
    I think there is no other method to update an existing list with Excel. It is only possible to create a new list based on an Excel-Sheet.
    To save an Excel sheet to a list, click Site Actions->More options->Import Spreadsheet.
    Browse for an appropriate file to import. The file will be imported as a list.
    Thanks.
    Tracy Cai
    TechNet Community Support

  • Access sharepoint list form visual studio

    I am trying to access share point  site as data source in visual studio .I am getting below error.Please help me resolve this error.
    The HTML document does not contain Web service discovery information.
    Metadata contains a reference that cannot be resolved: 'http://cwfsp5/Content Management/Lists/Bookmark Definitions/AllItems.aspx'.
    The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.
    The remote server returned an error: (401) Unauthorized.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    var siteUrl = '/sites/MySiteCollection';
    function retrieveListItems() {
    var clientContext = new SP.ClientContext(siteUrl);
    var oList = clientContext.get_web().get_lists().getByTitle('Announcements');
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
    '<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
    this.collListItem = oList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    function onQuerySucceeded(sender, args) {
    var listItemInfo = '';
    var listItemEnumerator = collListItem.getEnumerator();
    while (listItemEnumerator.moveNext()) {
    var oListItem = listItemEnumerator.get_current();
    listItemInfo += '\nID: ' + oListItem.get_id() +
    '\nTitle: ' + oListItem.get_item('Title') +
    '\nBody: ' + oListItem.get_item('Body');
    alert(listItemInfo.toString());
    function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    http://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx

  • Email and Phone number added to contact list without permission?

    Just discovered an email and phone number added to my contact list under my name and its not mine! How did this happen? Can't call Apple because my 90 days has expired and they won't answer the question without me paying!! So frustrating!! Hoping someone has an answer for me??

    What is the full message of the notification ? If your phone number and email address were added to, for example, the Messages app on another device then you will need to go to that other device to remove them from it

  • How can i access sharepoint list using access token?

    Hi All,
    I have a office 365 outlook web app. There are three setting in this app like site URL, user id and password. Here site URL is a sharepoint app url where have some list. User id and password is the current user authentication information.
    I have a WCF service which gets the site url and authentication information to do operation in list in sharepoint app. There is a condition to publish App in app store, App should not take user id and password.
    As the user is currently authenticated i need to use that information to do operation is list. I don't understand how can i create clientcontext from the current user. In outlook app i don't have any server side code, i have only java script how can i get
    the token information in client side?
    Samaresh 

    Hi All,
    I have a office 365 outlook web app. There are three setting in this app like site URL, user id and password. Here site URL is a sharepoint app url where have some list. User id and password is the current user authentication information.
    I have a WCF service which gets the site url and authentication information to do operation in list in sharepoint app. There is a condition to publish App in app store, App should not take user id and password.
    As the user is currently authenticated i need to use that information to do operation is list. I don't understand how can i create clientcontext from the current user. In outlook app i don't have any server side code, i have only java script how can i get the
    token information in client side?
    Samaresh 

  • Preventing access to web without permission

    Is there some way to set up Firefox so that you cannot browse unless you have permission (password, etc.)? My daughter, who has Down Syndrome, knows how to browse for her games, but I don't want her using them without my permission. I'm trying to help her manage her time better, but she sneaks into the computer and is already happily playing her games before I know it! Is there something you can suggest?

    See http://themacmob.com/parental-controls-in-mac-os-x-lion/

  • How to copy Excel sheet data to SharePoint 2010 List?

    Hi,
       I need to export excel data to SharePoint 2010 list. I have created 22 columns in list which are of following Column types:
    Single line of text,
    Multiple line of text,
    Choice
    Number,
    Date,
    Person or Group.
    Now i need to export the excel data to SharePoint list.
    When iam trying to copy data from excel to List , it is showing as "The selected cells are read only".
    can someone guide on this to export spread sheet data to SharePoint list without importing Spreadsheet.
    Thanks in advance.
    Badri

    I've updated the example of using PowerShell to include a Person field (user field) and a choice field.
    The CSV file has the following columns:
    TRIP_NO
    VESSEL_NAME
    FLAG
    AGENT_NAME
    CURRENT_LOCATION
    RPT_DATE
    EMPLOYEE
    EMPLOYEE_TYPE
    #Get the CSV file and connect to the SharePoint list
    $vessellist = import-csv -Path C:\Temp\VesselInPortReport.csv
    $l = (Get-Spweb "http://devmy101").GetList("http://devmy101/Lists/smarInPort")
    #Get the lists EmployeeType field (choice)
    $employeeType = $l.Fields["EmployeeType"] -as [Microsoft.SharePoint.SPFieldChoice]
    #Loop through the items and add them to the list
    $r = 1;
    foreach($item in $vessellist)
    $ni = $l.items.Add();
    #Add the Title, using the rows VESSEL_NAME column
    $ni["Title"] = $item.VESSEL_NAME;
    #Add the "Date Recorded" field, using the csv rows "RPT_DATE" column
    [DateTime]$rd = New-Object System.DateTime;
    if([DateTime]::TryParse($item.RPT_DATE, [ref]$rd)){
    $ni["Date Recorded"] = $rd;
    #Add the csv rows "TRIP_NO" column to the new list items "Trip Id" field (SPFieldNumber)
    [Int64]$tn = New-Object System.Int64;
    if([Int64]::TryParse($item.TRIP_NO, [ref] $tn)){
    $ni["Trip Id"] = $tn;
    #Add some other text properties
    $ni["Flag"] = $item.FLAG;
    $ni["Agent Name"] = $item.AGENT_NAME;
    $ni["Current Location"] = $item.CURRENT_LOCATION;
    #Add user information
    $ni["employee"] = $w.EnsureUser($item.EMPLOYEE); #In this case, the $item.EMPLOYEE value from the spreadsheet is a persons name. Eg. "Matthew Yarlett"
    $employeeType.ParseAndSetValue($ni,$item.EMPLOYEE_TYPE); #In this case, the $item.EMPLOYEE_TYPE value from the spreadsheet is valid choice present in the EmployeeType list field. Eg. "Manager"
    #Update the item
    $ni.Update()
    Write-Host ([String]::Format("Added record:{0}",$r));
    $r++;
    Regards, Matthew
    MCPD | MCITP
    My Blog
    Please remember to click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if it was useful.
    I just added a webpart to the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • How to import MS Excel data into an exisiting SharePoint List?

    Hi Guys,
    Is it possible to import an excel list or excel data into a SharePoint List that has already been created? Not create a new list.
    I know you can import a spreadsheet which will create a new list, but I don't want that because I have created columns already  that do calculations and such and I don't want to recreate them....
    It can be either an excel or access list, but I want to make sure the pre-existing columns in still my SharePoint list.

    Sure,
    Go to list datasheet view in IE
    Open excel and copy the range
    Paste in datasheet view
    If column range match and validation overcome, data will start pasting as expected.
    http://3sharp.com/blog/copy-and-paste-from-excel-to-a-sharepoint-list/
    https://clintoncherry.wordpress.com/2008/02/27/bulk-copy-and-paste-into-a-sharepoint-list/
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/3c60ee05-1408-4b73-bb2b-2d42bf913572/how-to-copy-excel-sheet-data-to-sharepoint-2010-list
    Hope this will help
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • How create animated power view reports using sharepoint list as a data source in sharepoint 2010?

    Hi All,
    I got a client requirement to create reports using SharePoint List as data source. The report should show reflection depends on values changed (I mean animation).
    I have heard about the power view/power pivot which does this kind of animations in reports.
    Can someone please guide me on creating reports which shows animations
    In power view/power pivot using SharePoint List as data source in SharePoint 2010.
    Thanks in advance.
    MercuryMan

    Hi MercuryMan,
    Yes, Power View, a feature of SQL Server 2012 Reporting Services Add-in for Microsoft SharePoint Server 2010 or SharePoint 2013 Enterprise Edition, is an interactive data exploration, visualization, and presentation experience.
    It provides multiple views featuring tiles, slicers, a chart filter, and a number of visualizations, including cards, small multiples, and a bubble chart. So, we can use Power View to do intuitive ad-hoc reporting for business users such as data analysts, business
    decision makers, and information workers.
    Currently, Power View report only supports two types of data models: PowerPivot Worksheet, and data models based on Analysis Services Tabular Model or Multidimensional Cube.
    In your scenario, you can create PowerPivot worksheets using SharePoint List as data source, deploy the PowerPivot worksheet to a SharePoint Library or PowerPivot Gallery, and then generate Power View reports based on the PowerPivot worksheets on the SharePoint
    site.
    To use SharePoint List as data source in Excel PowerPivot, you can refer to the following resource:
    http://blogs.technet.com/b/excel_services__powerpivot_for_sharepoint_support_blog/archive/2013/07/11/excel-services-using-a-sharepoint-list-as-a-data-source.aspx 
    http://technet.microsoft.com/en-us/library/hh230322.aspx 
    To create a Power View report based on PowerPivot model, you can refer to the following links:
    http://technet.microsoft.com/en-us/library/hh231522.aspx 
    http://technet.microsoft.com/en-us/library/hh759325.aspx 
    Regards,
    Mike Yin
    If you have any feedback on our support, please click
    here
    Mike Yin
    TechNet Community Support

  • How to get Client ID and Client Secret for Office App for Word which accessing SharePoint Online

    we currently implementing an Office App for MS Word which access SharePoint list and get data from lists. Our aim is any user can get this app from Office App store and enter their SharePoint URL and browse their own SharePoint lists and use those. When
    I was checking mechanisms which you used to access SharePoint, in some of them have used ClientId and Client Secret to authenticate with SharePoint. I have following questions.
    1.If I want to sell my app using Office app store where can I get those clientId and client secret which is used to  get the access tokens.
    2.Is it possible to create SharePoint app and publish it to SharePoint app store and get clientId and client secret and use it when accessing through office. So users first download our SharePoint app install it to their SharePoint environment then get out
    Office App from Office app store and add it to word. Will this work?

    Hi,
    >> We are planning to develop an Office app to access SharePoint Online and SharePoint on Premise from Microsoft word.
    I’m not very familiar with SharePoint development, so please correct me if I have any misunderstandings about your requirement.
    The basic components of an app for Office are an XML manifest file and the default webpage of your app (server side).
    >> If I'm publishing my Office App for Word in to the Microsoft office app store, how do I get the ClientId and ClientSecret which I need to pass to authenticate with SharePoint online?
    As far as I know, when register your web app to SharePoint Online, you will get the ClientId and ClientSecret from the Azure Active Directory. And you need to store the Client ID and Client
    Secret on the app server side.
    For details, you could reference the article
    Building an Office 365 ASP.NET MVC app.
    >> If ClientId and ClientSecret not providing when we publishing Word Office App to the app store how what the ways which we can use to authenticate with SharePoint using Word Office app?
    You don’t need to provide the ClientId and ClientSecret when publishing your App to App Store. They are stored on your app server side.
    By the way, if you have the question about how to access the SharePoint resource in a Web Application, I will suggest you posting the questions to
    SharePoint Development Forum. For this forum, we mainly discuss the questions about using the Office JavaScript API to develop Apps for Office.
    Regards,
    Jeffrey
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Excel 2010 Synchronize List with SharePoint List using VBA

    I have used and loved the interaction between Excel and SharePoint for many generations of both solutions.  It's a wonderful opportunity to integrate the familiarity and simplicity of Excel (formatting, ease of use, availability) with the data storage
    and centralized list capabilities of SharePoint.  Right?
    When upgrading to Excel 2010, I have noticed with much dismay that much of the inherent easy to use features of previous versions were effectively stripped from this newest version.  Much research, time and energy has been spent working around and resolving
    the deficiency.  One Microsoft based article,
    http://support.microsoft.com/kb/930006, has provided the mechanics behind utilizing the "hidden" functionality... although, this capability to use VBA to create the synchronized list was available in previous versions.  However, once Microsoft
    published this article to this "hidden" functionality... I feel that the behavior should be supported by Microsoft in some way.  OK?
    Revised instructions to reproduce the problem:
    1. Create a SharePoint list with 20 dummy records.
    - Note the List Name  ##LIST_NAME##
    - Note the View GUID  ##VIEW_GUID##
    - Note SharePoint Base URL  ##BASE_URL##
    2. REVISED... In Excel 2010, save the file as Compatible "Excel 97-2003 Workbook".  Close the file and reopen.  Create a connected table (ListObject) in Excel using the article above to the SharePoint list.  Use Sample VBA code
    below:
    Sub LinkedSharePointList()    
    ActiveSheet.ListObjects.Add SourceType:=xlSrcExternal,_
        Source:=Array(##BASE_URL## & "/_vti_bin", ##LIST_NAME##, _
        ##VIEW_GUID##), LinkSource:=True, Destination:=Range("A1")
    End Sub
    3. OOPS REVISED this item.  The problem is actually with ROW 21... So, update record on row 21... (no matter where the table is located... (if the "Destination" is "A1", then the problem is with ID=20, but if the Table is
    shifted down to say A12, then ID=9 on row 21).  Anyway... make a simple change to that record... and you'll see the ID immediately change.... as if it's a NEW record.  WEIRD!  Note: If the sheet is protected, then an error is displayed
    indicating that a "read-only" record cannot be updated (referring to the ID cell in column A for the current row). 
    4. Now "synchronize" the list with excel.  The former record is still in the list unchanged AND there is a NEW record in the list holding the changes.  There are a number of problems that seem to ONLY occur when something changes to ROW
    21.... Next, try to copy/paste multiple records across multiple rows that intersect with ROW 21.  Yikes!! 
    I look forward to hearing others' experience!
    Thanks!
    Mark

    Here are some things that you can try (change the code, where appropriate):
    Private Sub CreateList()
        Dim folder As folder
        Dim f As File
        Dim fs As New FileSystemObject
        Dim RowCtr As Integer
        RowCtr = 1
        Set folder = fs.GetFolder("http://excel-pc:43231/Shared Documents/Forms/") '<=Variable Location
        For Each f In folder.Files
           Cells(RowCtr, 1).Value = f.Name
           RowCtr = RowCtr + 1
        Next f
    End Sub
    Sub ListAllFile()
     Dim objFSO As Object
     Dim objFolder As Object
     Dim objFile As Object
     Dim pth As String
     Dim WBn As Workbook
     Dim ObCount As Long
     Dim FileNme As String
     Application.ScreenUpdating = False
     Set objFSO = CreateObject("Scripting.FileSystemObject")
     'Get the folder object associated with the directory
     Set objFolder = objFSO.GetFolder("\\excel-pc:43231\Shared Documents\Forms\")
    '** You'll need to specify your path here. By removing the http: from the path, the code liked it & found the folder. It wasn’t working previously ***
     pth = "http://excel-pc:43231/Shared Documents/Forms/"
    '** You'll need to specify your path here. The reason I’ve done this separately is because the path is not recognised otherwise when trying to specify it with workbook.open & using the value set for objFolder **
     ObCount = objFolder.Files.Count
    '** counts the number of files in the folder
     'Loop through the Files collection
     For Each objFile In objFolder.Files
     Nm1 = Len("http://excel-pc:43231/Shared Documents/Forms/")
    '** You'll need to specify your path here **
     Nm2 = Len(objFile) - Nm1
     FileNme = Right(objFile, Nm2)
    '** I’ve done this part to find out/set the file name**
     Set WBn = Workbooks.Open(pth & FileNme, , , , Password:="YourPassword")
    '** opens the first file in the library – if there is no password, the remove everything from - , , , , Password:="Password1" – leaving the close bracket ‘)’
     Application.ScreenUpdating = False
    '** optional – you can leave the screen updating on
    '<< Your coding here>>
    '** The file is now open. Enter whatever code is specific to your spreadsheets.
     Next
    '** goes to next file within your sharepoint folder
    End Sub
    Sub SharePoint()
    Dim xlFile As String, xlFullFile As String
    Dim xlApp As Excel.Application
    Dim wb As Workbook
    xlFile = "\\excel-pc:43231\Shared Documents"
    'http://excel-pc:43231/Shared Documents/
    '****----denotes the path.(i.e) u give the path as windows search.Don't use "\" at the end.
    'In the sharepoint path %20 denotes space.so u remove that and use space .
    Set xlApp = New Excel.Application
    xlApp.Visible = True
    xlFullFile = GetFullFileName(xlFile, "Book") 'ANZ denotes starting characters of the file.
    xlFile = xlFile & "\" & xlFullFile
    Set wb = xlApp.Workbooks.Open(xlFile, , False)
    'Once the workbook is opened u can do ur code here
    wb.Close False
    End Sub
    Function GetFullFileName(strfilepath As String, _
    strFileNamePartial As String) As String
    Dim objFS As Variant
    Dim objFolder As Variant
    Dim objFile As Variant
    Dim intLengthOfPartialName As Integer
    Dim strfilenamefull As String
    Set objFS = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFS.GetFolder(strfilepath)
    'work out how long the partial file name is
    intLengthOfPartialName = Len(strFileNamePartial)
    For Each objFile In objFolder.Files 'Instead of specifying the starting characters of the file you can directly loop through all files in the folder .
    'Test to see if the file matches the partial file name
    If Left(objFile.Name, intLengthOfPartialName) = strFileNamePartial Then
    'get the full file name
    strfilenamefull = objFile.Name
    Exit For
    Else
    End If
    Next objFile
    Set objFolder = Nothing
    Set objFS = Nothing
    'Return the full file name as the function's value
    GetFullFileName = strfilenamefull
    End Function
    Sub SrchForFiles()
    ' Searches the selected folders and sub folders for files with the specified (xls) extension.
    'ListTheFiles 'get the list of all the target XLS files on the SharePoint Directory
    Dim i As Long, z As Long, Rw As Long, ii As Long
    Dim ws As Worksheet, dd As Worksheet
    Dim y As Variant
    Dim fldr As String, fil As String, FPath As String
    Dim LocName As String
    Dim FString As String
    Dim SummaryWB As Workbook
    Dim SummaryWS As Worksheet
    Dim Raw_WS As Worksheet
    Dim LastRow As Long, FirstRow As Long, RowsOfData As Long
    Dim UseData As Boolean
    Dim FirstBlankRow As Long
    'grab current location for later reference, for where to paste final data
    Set SummaryWB = Application.ActiveWorkbook
    Set SummaryWS = Application.ActiveWorkbook.ActiveSheet
    y = "xls"
    fldr = "\\excel-pc:43231\Shared%20Documents\Forms\AllItems.aspx"
    FirstBlankRow = 2
    'asd is a 1-D array of files returned
    asd = ListFiles(fldr, True)
    Set ws = Excel.ThisWorkbook.Worksheets(1) 'list of files
    ws.Activate
    ws.Range("A1:Z100").Select
    Selection.Clear
    On Error GoTo 0
    For ii = LBound(asd) To UBound(asd)
    Debug.Print Dir(asd(ii))
    fil = asd(ii)
    'open the file and grab the data
    Application.Workbooks.Open (fil), False, True
    'Get file path from file name
    FPath = Left(fil, Len(fil) - Len(Split(fil, "\")(UBound(Split(fil, "\")))) - 1)
    'Get file information
    If Left$(fil, 1) = Left$(fldr, 1) Then
    If CBool(Len(Dir(fil))) Then
    z = z + 1
    ws.Cells(z + 1, 1).Resize(, 6) = _
    Array(Dir(fil), LocName, RowsOfData, Round((FileLen(fil) / 1000), 0), FileDateTime(fil), FPath)
    DoEvents
    With ws
    .Hyperlinks.Add .Range("A" & CStr(z + 1)), fil
    '.FoundFiles(i)
    End With
    End If
    End If
    'Workbooks.Close 'Fil
    Application.CutCopyMode = False 'Clear Clipboard
    Workbooks(Dir(fil)).Close SaveChanges:=False
    Next ii
    With ws
    Rw = .Cells.Rows.Count
    With .[A1:F1]
    .Value = [{"Full Name","Location","Rows of Data","Kilobytes","Last Modified", "Path"}]
    .Font.Underline = xlUnderlineStyleSingle
    .EntireColumn.AutoFit
    .HorizontalAlignment = xlCenter
    End With
    .[G1:IV1 ].EntireColumn.Hidden = True
    On Error Resume Next
    'Range(Cells(Rw, "A").End(3)(2), Cells(Rw, "A")).EntireRow.Hidden = True
    Range(.[A2 ], Cells(Rw, "C")).Sort [A2 ], xlAscending, Header:=xlNo
    End With
    End Sub
    Function ListFiles(ByVal Path As String, Optional ByVal NestedDirs As Boolean) _
    As String()
    Dim fso As New Scripting.FileSystemObject
    Dim fld As Scripting.folder
    Dim fileList As String
    ' get the starting folder
    Set fld = fso.GetFolder(Path)
    ' let the private subroutine do all the work
    fileList = ListFilesPriv(fld, NestedDirs)
    ' (the first element will be a null string unless the first ";" is removed)
    fileList = Right(fileList, Len(fileList) - 1)
    ' convert to a string array
    ListFiles = Split(fileList, ";")
    End Function
    ' private procedure that returns a file list
    ' as a comma-delimited list of files
    Function ListFilesPriv(ByVal fld As Scripting.folder, _
    ByVal NestedDirs As Boolean) As String
    Dim fil As Scripting.File
    Dim subfld As Scripting.folder
    ' list all the files in this directory
    For Each fil In fld.Files
    'If UCase(Left(Dir(fil), 5)) = "MULTI" And fil.Type = "Microsoft Excel Worksheet" Then
    If fil.Type = "Microsoft Excel Worksheet" Then
    ListFilesPriv = ListFilesPriv & ";" & fil.Path
    Debug.Print fil.Path
    End If
    Next
    ' if requested, search also subdirectories
    If NestedDirs Then
    For Each subfld In fld.SubFolders
    ListFilesPriv = ListFilesPriv & ListFilesPriv(subfld, NestedDirs)
    Next
    End If
    End Function
    Finally . . .
    Sub ListFiles()
        Dim folder As Variant
        Dim f As File
        Dim fs As New FileSystemObject
        Dim RowCtr As Integer
        Dim FPath As String
        Dim wb As Workbook
        RowCtr = 1
        FPath = "http://excel-pc:43231/Shared Documents"
        For Each f In FPath
        'Set folder = fs.GetFolder("C:\Users\Excel\Desktop\Ryan_Folder")
        'For Each f In folder.Files
           Cells(RowCtr, 1).Value = f.Name
           RowCtr = RowCtr + 1
        Next f
    End Sub
    Sub test()
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objFolder = objFSO.GetFolder("C:\Users\Excel\Desktop\Ryan_Folder")
        'Set colSubfolders = objFolder.SubFolders
        'For Each objSubfolder In colSubfolders
           Cells(RowCtr, 1).Value = f.Name
           RowCtr = RowCtr + 1
        'Next
    End Sub
    Ryan Shuell

  • VBA code to update Excel Data in sharePoint list

    hi Team,
    I have excel sheet created having data. I need to upload it in sharepoint List.
    Please provide me VBA code for the same.

    Please try this.
    Sub UpdateSpecificCells()
    'If nobody has the file checked out
    If Workbooks.CanCheckOut("http://excel-pc:43231/Shared Documents/ExcelList.xlsb") = True Then
    Application.DisplayAlerts = False
    'Open the file on the SharePoint server
    Workbooks.Open Filename:="http://excel-pc:43231/Shared Documents/ExcelList.xlsb", UpdateLinks:=xlUpdateLinksNever
    ActiveSheet.Cells(2, 7).Value = 100
    ActiveSheet.Cells(3, 7).Value = 200
    ActiveSheet.Cells(4, 7).Value = 300
    'Close the workbook
    Workbooks("ExcelList.xlsb").Save
    Workbooks("ExcelList.xlsb").Close
    End If
    End Sub
    I haven't used SharePoint in many years, and I can't test that code now, but I've used that before to update Excel files in SharePoint.
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Excel links to Access DB Hosted on SharePoint?

    Hello-
    I manage a site for intercompany financial reporting, and I am attempting to automate our monthly reporting. Specifically, I want to use Access to automatically report data to specific excel spreadsheets hosted in secure files on our SharePoint for
    data visualization and analysis. The criteria for the system seem to make it unfeasible as far as I know, and that is why I am asking the question of how to do this here.  
    Objectives:
    1. Link an Access database located on the sharepoint site itself to numerous satellite excel spreadsheets. Hosting from my PC or a shared team drive isn't an option, as not everyone will be able to automatically "Refresh" data if its located there.
    Ive been able to link excel to databases on hard drives but not those on the SharePoint.
    2. Excel spreadsheets should refresh automatically, without any input from the site admins or end users. All I want my team to have to do is upload a new Access file at the month's end. That access file will have the same structure and queries every month,
    just updated with new data monthly.
    3. Data transfer should be one way. We want to be able to report out data but we do not want others to be able to alter it in such a way that it impacts the Access DB.
    In summary, we want to upload one Access DB and allow the queries to provide inputs for a number of reports so that those who need the information can open an excel file and view the most recent data without having to refresh it or us having to
    allow them editing privileges. Your thoughts are apprecciated.

    Hi Stags3648,
    First, if I understand correctly, you want to connect to an Access Data from an Excel file. Both the Access Data and Excel are stored in SharePoint library. If I have misunderstood anything, please don't hesitate to let me know.
    For your questions:
    1. We can connect to Acces file(in SharePoint) from Excel using the URL path. e.g.
    http://site/Shared%20Documents/, and then select the Access Database file.
    2. In order to force the Excel file to be refreshed, there is no out of box(OOF) solution.
    The possible workaround is using customized code to open the Excel file, refresh the data, and then save to SharePoint library again.
    3. If we just connect from Excel to Access, the end-users won't be able to change any data from Excel to Access by default.
    Excel is a good for data visualization and analysis. But why not using SQL Server Reporting Service(SSRS)? While using SSRS, end-users can be only able to view report, the reports can be refreshed automatically.
    Thanks,
    Jinchun Chen
    Jinchun Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff AT microsoft.com(Please replace AT with @)

Maybe you are looking for