?check if chapter contains hyperlink, if not, delete

  • Thread starter Frank via OfficeKB.com
  • Start date
F

Frank via OfficeKB.com

Hallo Champs

I am getting mad on the following:

Is it possible to check a value between two or more headlines (changing headline, about 100 in the document) and if the desired content does not exist = delete all between

Sample:

Should look like:
=================
Headline
anyword anyword
anyword anyword anyword anyword
URL

Headline
....

WHEN:
there is no URL or description between headline and url, the complete paragraph should be deleted

Is that possible?

Notice:
Must use wildcarts

Styles in use are
Headline=H1
Text=Normal
URL=Hyperlink


Thx for any hint

*****************************************
* This message was posted via http://www.officekb.com
*
* Report spam or abuse by clicking the following URL:
* http://www.officekb.com/Uwe/Abuse.aspx?aid=87333c7b0f4a4656bf84dd541bffccd5
*****************************************
 
H

Helmut Weber

Hallo Frank,
maybe this could be of help to you,
though quite a number of questions
have still to be answered.
Sub test891()
ResetSearch
With Selection
.ExtendMode = False
.HomeKey unit:=wdStory
End With
With Selection.Find
.Style = "H1"
While .Execute
Selection.Bookmarks("\headinglevel").Select
MsgBox Selection.Hyperlinks.Count
' do what you like
Selection.Collapse direction:=wdCollapseEnd
Wend
End With
ResetSearch
End Sub
' ---
Public Sub ResetSearch()
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top