Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Identifying workbooks with links to external file

I have a list of workbooks and I want to be able to determine which ones have
a link to an external file. All I want at this point is "YES" or "NO".
What do I need to do programmatically to capture if a link is present in a
file. I've got the FINDLINK utility available, but I need to know how many
documents are affected first.

Tell me what needs to be done to this

Sub LinksPresent()
Dim oWB As Workbook
Dim aWB As Workbook
Dim aWS As Worksheet

Set aWB = ActiveWorkbook
Set aWS = ActiveSheet
Range("H1").Select
ActiveCell.FormulaR1C1 = "Link Present"
For i = 2 To Cells(Rows.Count, "A").End(xlUp).row
Set oWB = Workbooks.Open(Cells(i, "B"), ReadOnly = True, UpdateLinks
= False)
Range("H" & i).Select
ActiveCell.FormulaR1C1 = "=WHAT GOES HERE"
Next i
aWB.Save
End Sub

Thanks in advance,
Barb Reinhardt




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Identifying workbooks with links to external file

Sub LinksPresent()
Dim oWB As Workbook
Dim aWB As Workbook
Dim aWS As Worksheet

Set aWB = ActiveWorkbook
Set aWS = ActiveSheet
Range("H1").Select
ActiveCell.FormulaR1C1 = "Link Present"
For i = 2 To Cells(Rows.Count, "A").End(xlUp).row
Set oWB = Workbooks.Open(Cells(i, "B"), ReadOnly = True, UpdateLinks
= False)
WS.Range("H" & i).Value = iif(commandbars("Edit") _
.Controls("Lin&ks...").Enabled,"Yes","No")
oWB.Close SaveChanges:=False
Next i
aWB.Save
End Sub

to get a list of links

Dim alinks as Variant
aLinks = oWB.LinkSources(xlExcelLinks)
If Not IsEmpty(aLinks) Then
For i = 1 To UBound(aLinks)
MsgBox "Link " & i & ":" & Chr(13) & aLinks(i)
Next i
End Ifto put them in the sheet

Dim aLinks as Variant
nLnks as Long
aLinks = oWB.LinkSources(xlExcelLinks)
nLnks = Ubound(aLinks) - lbound(alinks) + 1
WS.Range("H" & i).Resize(1,nLnks) = alinks


--
Regards,
Tom Ogilvy



"Barb Reinhardt" wrote in message
...
I have a list of workbooks and I want to be able to determine which ones

have
a link to an external file. All I want at this point is "YES" or "NO".
What do I need to do programmatically to capture if a link is present in a
file. I've got the FINDLINK utility available, but I need to know how

many
documents are affected first.

Tell me what needs to be done to this

Sub LinksPresent()
Dim oWB As Workbook
Dim aWB As Workbook
Dim aWS As Worksheet

Set aWB = ActiveWorkbook
Set aWS = ActiveSheet
Range("H1").Select
ActiveCell.FormulaR1C1 = "Link Present"
For i = 2 To Cells(Rows.Count, "A").End(xlUp).row
Set oWB = Workbooks.Open(Cells(i, "B"), ReadOnly = True,

UpdateLinks
= False)
Range("H" & i).Select
ActiveCell.FormulaR1C1 = "=WHAT GOES HERE"
Next i
aWB.Save
End Sub

Thanks in advance,
Barb Reinhardt






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Identifying workbooks with links to external file

I needed to change WS to aWS to get this to work

WS.Range("H" & i).Value = iif(commandbars("Edit") _
.Controls("Lin&ks...").Enabled,"Yes","No")


"Tom Ogilvy" wrote:

Sub LinksPresent()
Dim oWB As Workbook
Dim aWB As Workbook
Dim aWS As Worksheet

Set aWB = ActiveWorkbook
Set aWS = ActiveSheet
Range("H1").Select
ActiveCell.FormulaR1C1 = "Link Present"
For i = 2 To Cells(Rows.Count, "A").End(xlUp).row
Set oWB = Workbooks.Open(Cells(i, "B"), ReadOnly = True, UpdateLinks
= False)
WS.Range("H" & i).Value = iif(commandbars("Edit") _
.Controls("Lin&ks...").Enabled,"Yes","No")
oWB.Close SaveChanges:=False
Next i
aWB.Save
End Sub

to get a list of links

Dim alinks as Variant
aLinks = oWB.LinkSources(xlExcelLinks)
If Not IsEmpty(aLinks) Then
For i = 1 To UBound(aLinks)
MsgBox "Link " & i & ":" & Chr(13) & aLinks(i)
Next i
End Ifto put them in the sheet

Dim aLinks as Variant
nLnks as Long
aLinks = oWB.LinkSources(xlExcelLinks)
nLnks = Ubound(aLinks) - lbound(alinks) + 1
WS.Range("H" & i).Resize(1,nLnks) = alinks


--
Regards,
Tom Ogilvy



"Barb Reinhardt" wrote in message
...
I have a list of workbooks and I want to be able to determine which ones

have
a link to an external file. All I want at this point is "YES" or "NO".
What do I need to do programmatically to capture if a link is present in a
file. I've got the FINDLINK utility available, but I need to know how

many
documents are affected first.

Tell me what needs to be done to this

Sub LinksPresent()
Dim oWB As Workbook
Dim aWB As Workbook
Dim aWS As Worksheet

Set aWB = ActiveWorkbook
Set aWS = ActiveSheet
Range("H1").Select
ActiveCell.FormulaR1C1 = "Link Present"
For i = 2 To Cells(Rows.Count, "A").End(xlUp).row
Set oWB = Workbooks.Open(Cells(i, "B"), ReadOnly = True,

UpdateLinks
= False)
Range("H" & i).Select
ActiveCell.FormulaR1C1 = "=WHAT GOES HERE"
Next i
aWB.Save
End Sub

Thanks in advance,
Barb Reinhardt







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Identifying workbooks with links to external file

Glad you were able to figure it out.

--
Regards,
Tom Ogilvy


"Barb Reinhardt" wrote in message
...
I needed to change WS to aWS to get this to work

WS.Range("H" & i).Value = iif(commandbars("Edit") _
.Controls("Lin&ks...").Enabled,"Yes","No")


"Tom Ogilvy" wrote:

Sub LinksPresent()
Dim oWB As Workbook
Dim aWB As Workbook
Dim aWS As Worksheet

Set aWB = ActiveWorkbook
Set aWS = ActiveSheet
Range("H1").Select
ActiveCell.FormulaR1C1 = "Link Present"
For i = 2 To Cells(Rows.Count, "A").End(xlUp).row
Set oWB = Workbooks.Open(Cells(i, "B"), ReadOnly = True,

UpdateLinks
= False)
WS.Range("H" & i).Value = iif(commandbars("Edit") _
.Controls("Lin&ks...").Enabled,"Yes","No")
oWB.Close SaveChanges:=False
Next i
aWB.Save
End Sub

to get a list of links

Dim alinks as Variant
aLinks = oWB.LinkSources(xlExcelLinks)
If Not IsEmpty(aLinks) Then
For i = 1 To UBound(aLinks)
MsgBox "Link " & i & ":" & Chr(13) & aLinks(i)
Next i
End Ifto put them in the sheet

Dim aLinks as Variant
nLnks as Long
aLinks = oWB.LinkSources(xlExcelLinks)
nLnks = Ubound(aLinks) - lbound(alinks) + 1
WS.Range("H" & i).Resize(1,nLnks) = alinks


--
Regards,
Tom Ogilvy



"Barb Reinhardt" wrote in

message
...
I have a list of workbooks and I want to be able to determine which

ones
have
a link to an external file. All I want at this point is "YES" or

"NO".
What do I need to do programmatically to capture if a link is present

in a
file. I've got the FINDLINK utility available, but I need to know how

many
documents are affected first.

Tell me what needs to be done to this

Sub LinksPresent()
Dim oWB As Workbook
Dim aWB As Workbook
Dim aWS As Worksheet

Set aWB = ActiveWorkbook
Set aWS = ActiveSheet
Range("H1").Select
ActiveCell.FormulaR1C1 = "Link Present"
For i = 2 To Cells(Rows.Count, "A").End(xlUp).row
Set oWB = Workbooks.Open(Cells(i, "B"), ReadOnly = True,

UpdateLinks
= False)
Range("H" & i).Select
ActiveCell.FormulaR1C1 = "=WHAT GOES HERE"
Next i
aWB.Save
End Sub

Thanks in advance,
Barb Reinhardt









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
how do I break links to external workbooks en masse? Dave F Excel Discussion (Misc queries) 7 November 9th 07 09:52 PM
select all cells in an active sheet containg links to other (external) workbooks. al007 Excel Programming 6 February 18th 06 02:54 PM
Shade cells with links to external workbooks Steph[_6_] Excel Programming 2 September 6th 05 08:45 PM
how do I activate links without opening external workbooks? teh_chucksta Excel Discussion (Misc queries) 0 August 29th 05 11:22 PM
Identifying cells with external links using VBA Mark Jarvis Excel Programming 1 November 21st 03 03:50 AM


All times are GMT +1. The time now is 05:48 PM.

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"