Hi,
I have some code which loops through a given folder and deposits filenames and their locations among other details into a table on a worksheet:
I have some code that then loops through the Hyperlinks in the "File Link" field/column and saves these files to a static location within the code:
I now need to upgrade this routine by, instead of using a hard-coded file destination, have a user enter a new destination for each file in the table into a new field/column and for the code to use that.
The table is named "Ref_FileList" and the hyperlinks reside with the field "File Links", the new destinations can reside within a field named "File Destination". I'm still new to working with structured tables in VBA so any help you can give with altering my code to work with this table would be highly appreciated.
Thanks very much,
Rich
I have some code which loops through a given folder and deposits filenames and their locations among other details into a table on a worksheet:
I have some code that then loops through the Hyperlinks in the "File Link" field/column and saves these files to a static location within the code:
Code:
Sub Upload_to_Sharepoint()
Dim hlink As Hyperlink
Dim wb As Workbook
Dim saveloc As String
Dim filen As String
'Timer
Dim StartTime As Double: StartTime = Timer
Dim MinutesElapsed As String 'Remember time when macro starts
Application.ScreenUpdating = False
saveloc = "[URL unfurl="true"]https://xxx.com/xxx/TEST/Shared[/URL] Documents/"
For Each hlink In ThisWorkbook.Sheets("FileDirectory").Range("J:J").Hyperlinks
Set wb = Workbooks.Open(hlink.Address)
wb.SaveAs saveloc & ActiveWorkbook.Name
wb.Close True
Set wb = Nothing
Next
Application.ScreenUpdating = True
MinutesElapsed = Format((Timer - StartTime) / 86400, "hh:mm:ss")
txEnd = "Done. The code ran successfully in " & MinutesElapsed & "."
MsgBox txEnd
End Sub
I now need to upgrade this routine by, instead of using a hard-coded file destination, have a user enter a new destination for each file in the table into a new field/column and for the code to use that.
The table is named "Ref_FileList" and the hyperlinks reside with the field "File Links", the new destinations can reside within a field named "File Destination". I'm still new to working with structured tables in VBA so any help you can give with altering my code to work with this table would be highly appreciated.
Thanks very much,
Rich