Prompt for variable

  • Thread starter Thread starter benm
  • Start date Start date
B

benm

I have a main spreadsheet that is linked to other Spreadsheets. I
receive these other spreadsheets daily (i.e. MMDDYYYY.xls). I would
like to have the main spreadsheet prompt me for file name and then
replace all links within the main spreadsheet to point to the filename
entered.

Thanks in advance for your feedback!
 
Below is a macro for changing all links in a spreadsheet.

Sub Change_Links(

Dim CurrLink, NextLink As Strin

'*****Option 1 Promt User for Path Name*****
NextLink = InputBox("Enter File Name and Directory"

'*****Option 2 Enter Path On Worksheet****
' NextLink = Range("FilePath").Valu

aLinks = ActiveWorkbook.LinkSources(xlExcelLinks

If Not IsEmpty(aLinks) The
For i = 1 To UBound(aLinks
If Right(aLinks(i), 12) <> "CMDRGEN1.XLA" The
CurrLink = aLinks(i
End I
Next
End I

ActiveWorkbook.ChangeLink Name:=CurrLink, NewName:=NextLink, Type:=xlExcelLink
WriteError = Fals

End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top