Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find links to other worksheets using VBScript?

Hello,

I have a quandry, I am moving excel files between servers and would like to
impact assess the links in excel spreadsheet to other workbooks. The links
have for instance <drive letter:\folder name\[test.xls]Sheet1'!$A$1, if the
drive letter changed i would like to have some code which i can run against
the file which will update the links to point to the correct location. But i
also need some script which will display the link and whats it's point to.

anyone done this before? Thanks
--
The AD Designer

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Find links to other worksheets using VBScript?

The way I've done it is by creating an array of links and using Debug.Print
to display the links in the Immediate window of the VBE (Ctrl+G).

Sub AllLinks()

'create and define an array of the links in the spreadsheet
Dim AllLinks As Variant

AllLinks = ThisWorkbook.LinkSources(xlExcelLinks)

'check if there are any links
If Not IsEmpty(AllLinks) Then

'if there are links define an integer to count the number of links
'from the lower to the upper bound of the array
Dim i As Integer

For i = LBound(AllLinks) To UBound(AllLinks)

'print the links to the immediate window (ctrl + g)
Debug.Print AllLinks(i)

'go to the next link
Next i

'if there are no links in the workbook, the message box will inform the
user
Else
MsgBox Prompt:="There are no links in this workbook", Title:="NO
LINKS"

End If

End Sub

One thing to note, you can get around the problem of changing drive letters
by using the server name in the links rather than the drive letters
(\\servername\folder\etc...)
Reply
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
Links between worksheets and more... dinamcb Excel Worksheet Functions 0 February 7th 08 05:34 PM
Worksheets.add in VBScript overwrites existing worksheet donparkerjr Excel Worksheet Functions 3 November 9th 06 07:09 PM
How do I Find links in worksheets - not in any formula RDFr Excel Worksheet Functions 3 December 14th 05 10:41 PM
Links to other worksheets KimberlyC Excel Worksheet Functions 1 July 8th 05 12:23 AM
can't update links...can't find links GJR3599 Excel Discussion (Misc queries) 1 April 4th 05 04:56 PM


All times are GMT +1. The time now is 07:14 AM.

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

About Us

"It's about Microsoft Excel"