Hi guys,
I am trying to create a macro that change the connection direction after searching for a file that starts with "filename", for example, and the xtension for it is .xlsx and also the path will change because it goes into the C:\Users"username"\SharePoint\ folder and the username is always changing, since this is for more than one person.
I have tryed something like this:
It gives me no error, but i know that it isn't updating the connection because i tryed to change the file to filename1.xlsx and the connection is still going to filename.xlsx
I don't know if i am beeing cleary here because i know that is a little bit confuse.
Thanks
I am trying to create a macro that change the connection direction after searching for a file that starts with "filename", for example, and the xtension for it is .xlsx and also the path will change because it goes into the C:\Users"username"\SharePoint\ folder and the username is always changing, since this is for more than one person.
I have tryed something like this:
Code:
Private Sub FileSearch()
Dim qPath As String
qPath = Environ("Sharepoint") & "Folder\Subfolder\filename" & "*.xlsx"
'strPath = Application.GetOpenFilename(Title:=qPath, FileFilter:=".xlsx")
ActiveWorkbook.Connections.Item(1).OLEDBConnection.SourceConnectionFile = qPath
End Sub
It gives me no error, but i know that it isn't updating the connection because i tryed to change the file to filename1.xlsx and the connection is still going to filename.xlsx
I don't know if i am beeing cleary here because i know that is a little bit confuse.
Thanks