I am looking for a macro to call a SharePoint, select a file and have it auto populate into a designated tab. I have the below macro which allows be to select a file from my folders located on my computer but I cannot figure out how to do it with SharePoint. Anyone's help would be most appreciated.
Code:
Sub Reporting()
' Daily Macro
Dim tool_ws, filename, raw_ws, data_sheet As String
With Application
tool_ws = ActiveWorkbook.Name
filename = .GetOpenFilename("Excel Files (*.xls),*.xls," & "Text Files (*.txt),*.txt," & "All Files (*.*),*.*", 3, "Select the eLetters Data Source file")
End With
If filename = False Then
MsgBox "No file was selected to process"
Exit Sub
Else
Workbooks.Open filename ' open raw data file to process
raw_ws = ActiveWorkbook.Name
End If
Application.ScreenUpdating = False
Range(Range("A1"), Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Workbooks(tool_ws).Activate
Sheets("Data Source").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("Data Source").Name = "Data Source"
Range("A2").Select
ActiveCell.EntireRow.Delete
Application.DisplayAlerts = False
Workbooks(raw_ws).Close
Application.DisplayAlerts = True
Application.ScreenUpdating = False
With Application
filename = .GetOpenFilename("Excel Files (*.xls),*.xls," & "Text Files (*.txt),*.txt," & "All Files (*.*),*.*", 3, "Select the Media Bin file")
End With
If filename = False Then
MsgBox "No file was selected to process"
Exit Sub
Else
Workbooks.Open filename ' open raw data file to process
raw_ws = ActiveWorkbook.Name
End If
Application.ScreenUpdating = False
Range(Range("A1"), Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Workbooks(tool_ws).Activate
Sheets("Extract").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("Data Source").Name = "Data Source"
Range("A2").Select
ActiveCell.EntireRow.Delete
Application.DisplayAlerts = False
Workbooks(raw_ws).Close
Application.DisplayAlerts = True
Sheets("Extract").Select
End Sub
Last edited by a moderator: