Greetings,
This is my first post here and i am quite new to VBA I have been looking around this forum for a while and so far it helped me alot.
I have a question: I need a command button in a userform to execute a file browse window where the user can search for a file (word or pdf) save that file to a network location and put the link in a cell in the excel worksheet.
I have been looking around and found this solution by another user.
This solution looks great, however i would like to modify it so that the file browse and save action happens when the use selects a 'upload' command button.
instead of rightclicking a cell.
I Hope you gys can help me with this question!
The post where the code above is from is this
This is my first post here and i am quite new to VBA I have been looking around this forum for a while and so far it helped me alot.
I have a question: I need a command button in a userform to execute a file browse window where the user can search for a file (word or pdf) save that file to a network location and put the link in a cell in the excel worksheet.
I have been looking around and found this solution by another user.
Code:
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) ' Retreive cell column number
cell_check = ActiveCell.Column
If cell_check = 21 Then 'checks if Column 21 (U) is selected
Dim file_pick As Long
' Open the file dialog
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Show
' Display paths of each file selected
For file_pick = 1 To .SelectedItems.Count
file_address = .SelectedItems(file_pick)
Next file_pick
End With
' Created hyperlink and adds HERE text
ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:=file_address, TextToDisplay:="HERE"
'Disables Right Click menu
Cancel = True
End If
End Sub
This solution looks great, however i would like to modify it so that the file browse and save action happens when the use selects a 'upload' command button.
instead of rightclicking a cell.
I Hope you gys can help me with this question!
The post where the code above is from is this