![]() |
Linked File and Range
I need to be able to set up a Linked File that is referenced in 500 linked
locations in the Primary File and then be able to change the Linked File (by a macro asking the user to select a new file location) to reference a new source Linked File location, store the value from the source location and then update all of the links. Any help would be appreciated. I was looking at getting the file path using the following and then building each of the links manually, but the syntax is not correct: 'Get the File Path Dim TargetFileName As String TargetFileName = Application.GetOpenFilename ShtMacro.Range("RngFilePath").Value = TargetFileName 'Reset the Links Dim ExistingFileName As String Dim NewFileName As String Cells.Replace What:=ExistingFileName, Replacement:=NewFileName, LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False |
Linked File and Range
You could use .getopenfilename to find the new workbook, but why not use
Edit|Links (record a macro to get that syntax) to change the links. Troubled User wrote: I need to be able to set up a Linked File that is referenced in 500 linked locations in the Primary File and then be able to change the Linked File (by a macro asking the user to select a new file location) to reference a new source Linked File location, store the value from the source location and then update all of the links. Any help would be appreciated. I was looking at getting the file path using the following and then building each of the links manually, but the syntax is not correct: 'Get the File Path Dim TargetFileName As String TargetFileName = Application.GetOpenFilename ShtMacro.Range("RngFilePath").Value = TargetFileName 'Reset the Links Dim ExistingFileName As String Dim NewFileName As String Cells.Replace What:=ExistingFileName, Replacement:=NewFileName, LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False -- Dave Peterson |
All times are GMT +1. The time now is 03:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com