PC Review


Reply
Thread Tools Rate Thread

check for links

 
 
Spike
Guest
Posts: n/a
 
      31st May 2009
I will be grateful for a pece of code to check if a workbook opened by the
running macro has any links
--
with kind regards

Spike
 
Reply With Quote
 
 
 
 
Howard31
Guest
Posts: n/a
 
      31st May 2009
Hi Spike,

Try using the following function:

Function HasLink(WbName As String) As Boolean
HasLink = Not IsEmpty(Workbooks(WbName).LinkSources)
End Function

Sub TestHasLink()
On Error Resume Next
If HasLink("Book1.xlsm") Then
If Err = 9 Then Exit Sub 'If this workbook name is not valid

MsgBox "This Workbook has a link"
Else
MsgBox "No links"
End If
End Sub

Make sure that the parameter you pass as WbName is the name of an open
Workbook, and include the extension i.e .xls or xlsm...
--
A. Ch. Eirinberg


"Spike" wrote:

> I will be grateful for a pece of code to check if a workbook opened by the
> running macro has any links
> --
> with kind regards
>
> Spike

 
Reply With Quote
 
Howard31
Guest
Posts: n/a
 
      31st May 2009
Just to clerify, the funcftion will only tell you if that workbook is linked
to another workbook and not if another workbook is linked to it.
--
A. Ch. Eirinberg


"Howard31" wrote:

> Hi Spike,
>
> Try using the following function:
>
> Function HasLink(WbName As String) As Boolean
> HasLink = Not IsEmpty(Workbooks(WbName).LinkSources)
> End Function
>
> Sub TestHasLink()
> On Error Resume Next
> If HasLink("Book1.xlsm") Then
> If Err = 9 Then Exit Sub 'If this workbook name is not valid
>
> MsgBox "This Workbook has a link"
> Else
> MsgBox "No links"
> End If
> End Sub
>
> Make sure that the parameter you pass as WbName is the name of an open
> Workbook, and include the extension i.e .xls or xlsm...
> --
> A. Ch. Eirinberg
>
>
> "Spike" wrote:
>
> > I will be grateful for a pece of code to check if a workbook opened by the
> > running macro has any links
> > --
> > with kind regards
> >
> > Spike

 
Reply With Quote
 
Spike
Guest
Posts: n/a
 
      1st Jun 2009
Thank you very much for that works a treat
--
with kind regards

Spike


"Howard31" wrote:

> Just to clerify, the funcftion will only tell you if that workbook is linked
> to another workbook and not if another workbook is linked to it.
> --
> A. Ch. Eirinberg
>
>
> "Howard31" wrote:
>
> > Hi Spike,
> >
> > Try using the following function:
> >
> > Function HasLink(WbName As String) As Boolean
> > HasLink = Not IsEmpty(Workbooks(WbName).LinkSources)
> > End Function
> >
> > Sub TestHasLink()
> > On Error Resume Next
> > If HasLink("Book1.xlsm") Then
> > If Err = 9 Then Exit Sub 'If this workbook name is not valid
> >
> > MsgBox "This Workbook has a link"
> > Else
> > MsgBox "No links"
> > End If
> > End Sub
> >
> > Make sure that the parameter you pass as WbName is the name of an open
> > Workbook, and include the extension i.e .xls or xlsm...
> > --
> > A. Ch. Eirinberg
> >
> >
> > "Spike" wrote:
> >
> > > I will be grateful for a pece of code to check if a workbook opened by the
> > > running macro has any links
> > > --
> > > with kind regards
> > >
> > > Spike

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
check for links Spike Microsoft Excel Programming 2 1st Jun 2009 08:45 AM
check broken links? george.alliger@groupoe.com Microsoft ASP .NET 2 13th Feb 2008 06:53 PM
check this ya...... check the links..... lakshmi.chandra.pk@gmail.com Printers 1 1st Dec 2007 12:52 AM
Check these dotnet links Ayesha.Goyal@gmail.com Microsoft ASP .NET 0 29th May 2007 12:11 PM
Re: How to check URL links? Herfried K. Wagner [MVP] Microsoft VB .NET 1 8th Sep 2004 09:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:35 AM.