Solved

Access VB Download Files SharePoint 2013

Posted on 2016-09-10
11
63 Views
Last Modified: 2016-10-09
I'm trying to download a file from SP 2013 using a button on an Access form. Can example code be provided. Thanks
0
Comment
Question by:shieldsco
11 Comments
 
LVL 84
ID: 41793293
Do you have code that you've tried, but it didn't work? If so then post that and let us know what did not work, and we'll try to help. We're not really here to do your work for you, but rather to help you when you get stuck.
0
 

Author Comment

by:shieldsco
ID: 41793304
I got the code to work below but I would like to use a wild card (*) for any Excel file in the SP Folder. There will always only be one Excel file in the SP Folder.

On Error GoTo errHere
 
Dim strQRY As String
 
Dim strHTTP As String
Dim strFileToSave As String
 
strHTTP = "https://asfr.hhh.net/OF/OFSPO/hhsfmg/mwwg/Data%20Call%20%20DDA/2016%20September%20DDA%20Data%20Call.xlsx"
strFileToSave = "C:\Users\shieldsco\Documents\Vince.xlsx"
 
If fnDownloadHTTP(strHTTP, strFileToSave) = False Then      ' -- downlaod the file
    MsgBox "File DL failed. Make sure folder exist"
    GoTo ExitHere
End If
 
MsgBox "All files downloaded"
 
ExitHere:
    Exit Sub
errHere:
    MsgBox "Error"
    Resume ExitHere

Open in new window

0
 

Author Comment

by:shieldsco
ID: 41793308
I would like to download any file that has the xlxs extension in the SP folder
0
 
LVL 17

Assisted Solution

by:xtermie
xtermie earned 125 total points (awarded by participants)
ID: 41795806
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 31

Accepted Solution

by:
Helen_Feddema earned 250 total points (awarded by participants)
ID: 41796081
Here is some code using the FileDialog object to select an Excel workbook for further processing:

Public Function SelectFile() As String
'Requires Office XP (2002) or higher
'Requires a reference to the Microsoft Office Object Library
'Created by Helen Feddema 28-Oct-2012
'Last modified by Helen Feddema 28-Oct-2012

On Error GoTo ErrorHandler

   Dim fd As Office.FileDialog
   Dim varSelectedItem As Variant
   Dim strFileNameAndPath As String
   
   'Create a FileDialog object as a File Picker dialog box.
   Set fd = Application.FileDialog(msoFileDialogFilePicker)
   
   With fd
      'Set AllowMultiSelect to True to allow selection of multiple files
      .AllowMultiSelect = False
      .Title = "Browse for File"
      .ButtonName = "Select"
      .Filters.Clear
      .Filters.Add "Documents", "*.xlsx; *.xlsm", 1
      .InitialView = msoFileDialogViewDetails
      If .Show = -1 Then
         'Get selected item in the FileDialogSelectedItems collection
         'Have to use collection even if just one item is selected
         For Each varSelectedItem In .SelectedItems
            strFileNameAndPath = CStr(varSelectedItem)
         Next varSelectedItem
      Else
         Debug.Print "User pressed Cancel"
         strFileNameAndPath = ""
      End If
   End With
   
   SelectFile = strFileNameAndPath
   
ErrorHandlerExit:
   Set fd = Nothing
   Exit Function

ErrorHandler:
   MsgBox "Error No: " & Err.Number _
      & " in SelectFile procedure; " _
      & "Description: " & Err.Description
   Resume ErrorHandlerExit

End Function

Open in new window

0
 

Assisted Solution

by:shieldsco
shieldsco earned 125 total points (awarded by participants)
ID: 41796119
My code works...trying to download the file with the xlsx extension:

strHTTP = "https://asfr.hhh.net/OF/OFSPO/hhsfmg/mwwg/Data%20Call%20%20DDA/2016%20September%20DDA%20Data%20Call.xlsx

Open in new window

0
 

Author Comment

by:shieldsco
ID: 41799785
Thanks
0
 

Author Comment

by:shieldsco
ID: 41807221
I got the code to work below but I would like to use a wild card (*) for any Excel file in the SP Folder. There will always only be one Excel file in the SP Folder.
0
 
LVL 17

Expert Comment

by:xtermie
ID: 41835691
good comments made and solutions proposed
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now