Your technology certification is waiting. Enroll in Cloud Class ®
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)
'Set AllowMultiSelect to True to allow selection of multiple files
.AllowMultiSelect = False
.Title = "Browse for File"
.ButtonName = "Select"
.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)
Debug.Print "User pressed Cancel"
strFileNameAndPath = ""
SelectFile = strFileNameAndPath
Set fd = Nothing
MsgBox "Error No: " & Err.Number _
& " in SelectFile procedure; " _
& "Description: " & Err.Description
Open in new window
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"
MsgBox "All files downloaded"
Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
strHTTP = "https://asfr.hhh.net/OF/OFSPO/hhsfmg/mwwg/Data%20Call%20%20DDA/2016%20September%20DDA%20Data%20Call.xlsx
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.