small question for advanced users 
Author Message
 small question for advanced users

Hello,

Sorry for my brocken English.

I saw external application(EXE file), which is written in VB6(maybe).
This application displays all the addresses of ABSOLUTELY ALL
hyperlinks in one document.

Can I write a macro in VBA, which display in Immediate window (with
Debug.Print) addresses of ABSOLUTELY ALL the hyperlinks in the
document? And How?

Thanks of all the advanced users in this forum!

tony



Fri, 04 Nov 2005 19:54:55 GMT  
 small question for advanced users
Hi Tony,

If the following macro is run when the document containing the hyperlinks is
the active document, it should create a new document containing a list of
all of the addresses of the hyperlinks:

Dim Source As Document, Target As Document, hlink As Hyperlink
Set Source = ActiveDocument
Set Target = Documents.Add
For Each hlink In Source.Hyperlinks
    Target.Range.InsertAfter hlink.Address & vbCr
Next hlink

Please respond to the newsgroups for the benefit of others who may be
interested.

Hope this helps
Doug Robbins - Word MVP

Quote:
> Hello,

> Sorry for my brocken English.

> I saw external application(EXE file), which is written in VB6(maybe).
> This application displays all the addresses of ABSOLUTELY ALL
> hyperlinks in one document.

> Can I write a macro in VBA, which display in Immediate window (with
> Debug.Print) addresses of ABSOLUTELY ALL the hyperlinks in the
> document? And How?

> Thanks of all the advanced users in this forum!

> tony



Fri, 04 Nov 2005 20:37:05 GMT  
 small question for advanced users
Hi Doug,

Thank you for the fast answer. I am thankful to you.

Sorry again for my brocken English

I don't know good English and this is the reason to give a small
explanation, but now I'll try to give, because is necessary.

I am a developer with a lot of experience in VB programming. And I
know for this code (and this is the reason to ask only advanced
users), but this code is not correct. Why?

Put a hyperlink in the heather, footer, textbox, footnote, endnote.(O,
so many places). Or somewhere else, but not in the main text. And you
will see that in the new document have not addresses of hyperlink,
placed in heather, footer, textbox, footnote, endnote.

The problem is, that the hyperlinks are not the same, like a
bookmarks.
In the Bookmark collection, when you use ActiveDocument.Bookmarks, you
can get all the bookmarks in the document, everywhere. (in maintext,
footnote, endnote, textbox, header, footer, and so on.) Order
alfabeticaly. But with the hyperlinks is not the same. With Hyprlinks
collection you can get only the hyperlinks in the main text, but you
can insert hyperlink everywhere.

I thought that there are no way to get addresses of the hyperlink,
which is not in the main text. But when i saw the external
application, which can do it. I understand that have way and i decide
to ask advanced users in the forum.
Because it is not easy to get something, that Word can't give it to
you.

Thank you again.

Best regards
tony


Quote:
> Hi Tony,

> If the following macro is run when the document containing the hyperlinks is
> the active document, it should create a new document containing a list of
> all of the addresses of the hyperlinks:

> Dim Source As Document, Target As Document, hlink As Hyperlink
> Set Source = ActiveDocument
> Set Target = Documents.Add
> For Each hlink In Source.Hyperlinks
>     Target.Range.InsertAfter hlink.Address & vbCr
> Next hlink

> Please respond to the newsgroups for the benefit of others who may be
> interested.

> Hope this helps
> Doug Robbins - Word MVP


> > Hello,

> > Sorry for my brocken English.

> > I saw external application(EXE file), which is written in VB6(maybe).
> > This application displays all the addresses of ABSOLUTELY ALL
> > hyperlinks in one document.

> > Can I write a macro in VBA, which display in Immediate window (with
> > Debug.Print) addresses of ABSOLUTELY ALL the hyperlinks in the
> > document? And How?

> > Thanks of all the advanced users in this forum!

> > tony



Sat, 05 Nov 2005 18:25:14 GMT  
 small question for advanced users
Hi Tony,

See the article "Using a macro to replace text where ever it appears in a
document including Headers, Footers, Textboxes, etc." at

http://www.mvps.org/word/FAQs/MacrosVBA/FindReplaceAllWithVBA.htm

Please respond to the newsgroups for the benefit of others who may be
interested.

Hope this helps
Doug Robbins - Word MVP

Quote:
> Hi Doug,

> Thank you for the fast answer. I am thankful to you.

> Sorry again for my brocken English

> I don't know good English and this is the reason to give a small
> explanation, but now I'll try to give, because is necessary.

> I am a developer with a lot of experience in VB programming. And I
> know for this code (and this is the reason to ask only advanced
> users), but this code is not correct. Why?

> Put a hyperlink in the heather, footer, textbox, footnote, endnote.(O,
> so many places). Or somewhere else, but not in the main text. And you
> will see that in the new document have not addresses of hyperlink,
> placed in heather, footer, textbox, footnote, endnote.

> The problem is, that the hyperlinks are not the same, like a
> bookmarks.
> In the Bookmark collection, when you use ActiveDocument.Bookmarks, you
> can get all the bookmarks in the document, everywhere. (in maintext,
> footnote, endnote, textbox, header, footer, and so on.) Order
> alfabeticaly. But with the hyperlinks is not the same. With Hyprlinks
> collection you can get only the hyperlinks in the main text, but you
> can insert hyperlink everywhere.

> I thought that there are no way to get addresses of the hyperlink,
> which is not in the main text. But when i saw the external
> application, which can do it. I understand that have way and i decide
> to ask advanced users in the forum.
> Because it is not easy to get something, that Word can't give it to
> you.

> Thank you again.

> Best regards
> tony




- Show quoted text -

Quote:
> > Hi Tony,

> > If the following macro is run when the document containing the
hyperlinks is
> > the active document, it should create a new document containing a list
of
> > all of the addresses of the hyperlinks:

> > Dim Source As Document, Target As Document, hlink As Hyperlink
> > Set Source = ActiveDocument
> > Set Target = Documents.Add
> > For Each hlink In Source.Hyperlinks
> >     Target.Range.InsertAfter hlink.Address & vbCr
> > Next hlink

> > Please respond to the newsgroups for the benefit of others who may be
> > interested.

> > Hope this helps
> > Doug Robbins - Word MVP


> > > Hello,

> > > Sorry for my brocken English.

> > > I saw external application(EXE file), which is written in VB6(maybe).
> > > This application displays all the addresses of ABSOLUTELY ALL
> > > hyperlinks in one document.

> > > Can I write a macro in VBA, which display in Immediate window (with
> > > Debug.Print) addresses of ABSOLUTELY ALL the hyperlinks in the
> > > document? And How?

> > > Thanks of all the advanced users in this forum!

> > > tony



Sun, 06 Nov 2005 17:24:09 GMT  
 small question for advanced users
Hi Doug,

Perfect. Big Thanks for the answer.

Thanks to your article : "Using a macro to replace text where ever it
appears in a document including Headers, Footers, Textboxes, etc.", I
think that i find right answer. I expand, a little, your code to this:

    Dim Source As Document, Target As Document, hlink As Hyperlink
    Dim SourceStoryRange As Range
    Set Source = ActiveDocument
    Set Target = Documents.Add
    For Each SourceStoryRange In Source.StoryRanges
        For Each hlink In SourceStoryRange.Hyperlinks
            Target.Range.InsertAfter hlink.Address & vbCr
        Next hlink
    Next SourceStoryRange

And now i get the addresses of all the hyperlink in the active
document.

Thank you again for the perfect answer and for the great article.
You are not only advanced user - You are a BIG SPECIALIST. Believe to
me.

Best Regards
tony


Quote:
> Hi Tony,

> See the article "Using a macro to replace text where ever it appears in a
> document including Headers, Footers, Textboxes, etc." at

> http://www.mvps.org/word/FAQs/MacrosVBA/FindReplaceAllWithVBA.htm

> Please respond to the newsgroups for the benefit of others who may be
> interested.

> Hope this helps
> Doug Robbins - Word MVP


> > Hi Doug,

> > Thank you for the fast answer. I am thankful to you.

> > Sorry again for my brocken English

> > I don't know good English and this is the reason to give a small
> > explanation, but now I'll try to give, because is necessary.

> > I am a developer with a lot of experience in VB programming. And I
> > know for this code (and this is the reason to ask only advanced
> > users), but this code is not correct. Why?

> > Put a hyperlink in the heather, footer, textbox, footnote, endnote.(O,
> > so many places). Or somewhere else, but not in the main text. And you
> > will see that in the new document have not addresses of hyperlink,
> > placed in heather, footer, textbox, footnote, endnote.

> > The problem is, that the hyperlinks are not the same, like a
> > bookmarks.
> > In the Bookmark collection, when you use ActiveDocument.Bookmarks, you
> > can get all the bookmarks in the document, everywhere. (in maintext,
> > footnote, endnote, textbox, header, footer, and so on.) Order
> > alfabeticaly. But with the hyperlinks is not the same. With Hyprlinks
> > collection you can get only the hyperlinks in the main text, but you
> > can insert hyperlink everywhere.

> > I thought that there are no way to get addresses of the hyperlink,
> > which is not in the main text. But when i saw the external
> > application, which can do it. I understand that have way and i decide
> > to ask advanced users in the forum.
> > Because it is not easy to get something, that Word can't give it to
> > you.

> > Thank you again.

> > Best regards
> > tony



> > > Hi Tony,

> > > If the following macro is run when the document containing the
>  hyperlinks is
> > > the active document, it should create a new document containing a list
>  of
> > > all of the addresses of the hyperlinks:

> > > Dim Source As Document, Target As Document, hlink As Hyperlink
> > > Set Source = ActiveDocument
> > > Set Target = Documents.Add
> > > For Each hlink In Source.Hyperlinks
> > >     Target.Range.InsertAfter hlink.Address & vbCr
> > > Next hlink

> > > Please respond to the newsgroups for the benefit of others who may be
> > > interested.

> > > Hope this helps
> > > Doug Robbins - Word MVP


> > > > Hello,

> > > > Sorry for my brocken English.

> > > > I saw external application(EXE file), which is written in VB6(maybe).
> > > > This application displays all the addresses of ABSOLUTELY ALL
> > > > hyperlinks in one document.

> > > > Can I write a macro in VBA, which display in Immediate window (with
> > > > Debug.Print) addresses of ABSOLUTELY ALL the hyperlinks in the
> > > > document? And How?

> > > > Thanks of all the advanced users in this forum!

> > > > tony



Mon, 07 Nov 2005 00:02:38 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. just a small, small question ...

2. just a small, small question ...

3. Subform editing with code (Advanced users)

4. user groups and advanced find

5. An advanced users help is required!!

6. ADVANCED USERS! (HELP

7. Advanced users! (Help needed)

8. New Registry tip for advanced users

9. A please for help from the most advanced VB users

10. Advanced Visual Basic Users

11. Visual Basic For Beginners/Advanced Users Welcomed

12. VB Advanced User, Help me

 

 
Powered by phpBB® Forum Software