Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access VB Download Files SharePoint 2013

Posted on 2016-09-10
11
Medium Priority
?
100 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 85
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 18

Assisted Solution

by:xtermie
xtermie earned 500 total points (awarded by participants)
ID: 41795806
0
 
LVL 31

Accepted Solution

by:
Helen Feddema earned 1000 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 500 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 18

Expert Comment

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

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

715 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