Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-28-2015, 03:12 AM
PRA007's Avatar
PRA007 PRA007 is offline Find whether string contains hyperlink and Process the same Windows 7 64bit Find whether string contains hyperlink and Process the same Office 2010 32bit
Competent Performer
Find whether string contains hyperlink and Process the same
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default Find whether string contains hyperlink and Process the same

As part of long process, I want to find following string:



Code:
EP [0-9]{5,} [0-9A-Z]{1,2}
and if it contains hyperlink i would like to use that link to process it for winhttp request like this.
if in doc, there is
EP 2614045 B1 with hyperlink https://data.epo.org/publication-ser...45&ki=B1&lg=en

Code:
Sub EPHYPERLINKDOWN()
Dim myURL As String, s As String, s1 As String, StrTxt As String
myURL = "https://data.epo.org/publication-server/document?cc=EP&pn=2614045&ki=B1&lg=en"

Dim HttpReq As Object, oStrm As Object
Set HttpReq = CreateObject("Microsoft.XMLHTTP")
HttpReq.Open "GET", myURL, False
HttpReq.send

s = HttpReq.responseText
Set HttpReq = Nothing
Set DocNew = Documents.Add
With DocNew
  .Range.Text = s
    With ActiveDocument.Range
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Forward = True
      .Wrap = wdFindContinue
      .Format = False
      .MatchWildcards = True
      .Text = "https://data.epo.org/publication-server/pdf-document*.pdf*.pdf"
      .Replacement.Text = ""
      .Execute
    End With
    s1 = Replace(.Text, "amp;", "")
    End With
    .Close
Set DocNew = Nothing
Application.ScreenUpdating = True
MsgBox (s1)
End With
End Sub
I want to remove original hyperlink with MsgBox Hyperlink.

So, I learned middle part but don't know how to run first part and last one.
Reply With Quote
 

Tags
word vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Hyperlink to a single string PRA007 Word VBA 7 11-09-2015 04:29 PM
Find whether string contains hyperlink and Process the same find a set of characters in a string and return a 0 (zero) if not found MaineLady Excel 2 11-05-2015 03:23 PM
Find whether string contains hyperlink and Process the same Why is this Find string not working TechEd Word VBA 5 07-05-2014 08:12 PM
Find whether string contains hyperlink and Process the same Find and replace a string of text errtu Word 1 01-31-2013 02:09 PM
Find whether string contains hyperlink and Process the same Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft