LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default changelink with the name and new name as strings is failing

below is the code I am using and it is failing at the changelink command.
Any clues as to why? When I recorded a change link and then tested the
recording by change the xls names around it worked fine. Thanks in advance.

Sub Restorelinks()
Dim savefilename As String
Dim PATH, link As String
Set oldactive = ActiveSheet

Application.ScreenUpdating = False

Const iTitle = "Save Data File" ' title of dialog box
Const FilterList = "Microsoft Excel Workbook (*.xls),*.xls"
PATH = Application.GetSaveAsFilename(savefilename, FilterList, , iTitle)

On Error GoTo ErrorHandler
Worksheets("data").Visible = True
Worksheets("data").Select


aLinks = ActiveWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(aLinks) Then
For i = 1 To UBound(aLinks)
link = Chr(13) & aLinks(i)
Next i
End If

ActiveWorkbook.ChangeLink Name:=link, NewName:=PATH, Type:=xlExcelLinks


Worksheets("data").Visible = False
oldactive.Select
Application.ScreenUpdating = True

ErrorHandler:
If Err.Number < 0 Then
MsgBox "error occured"
Exit Sub
End If
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ChangeLink error Keith[_7_] Excel Programming 0 April 30th 04 07:46 PM
ChangeLink Joe Bannister Excel Programming 2 April 19th 04 09:42 AM
ChangeLink Joe Bannister Excel Programming 0 January 26th 04 09:05 AM
ChangeLink Joe Bannister[_2_] Excel Programming 0 January 12th 04 03:29 PM
ChangeLink Joe Bannister Excel Programming 1 December 1st 03 02:55 PM


All times are GMT +1. The time now is 02:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"