![]() |
|
#1
|
||||
|
||||
![]()
Cross-posted at: http://answers.microsoft.com/en-us/o...3-5bd69975ea31
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
||||
|
||||
![]()
Apology For Not mentioning. I Generally do Mention While Cross posting.
This time as I have done it from home, that might be the reason. I Also cross posted this message and did mention: http://stackoverflow.com/questions/3...microsoft-word Did not get answer. I asked it different way still did not get the answer. I get suggestion from Cindy Meister[Microsoft MVP since 1996] which was similar to the suggestion given by You. Quote:
I started learning and will get the answer anyway on my own and will surely post it here. |
#3
|
||||
|
||||
![]()
This is one step towards answering my question.
Code:
Sub USPTOAbstHTML1() Application.ScreenUpdating = False Dim Rng As Range, Tbl As table, StrTxt As String, HttpReq As Object, i As Long, oHtml As MSHTML.HTMLDocument, IE As SHDocVw.InternetExplorer Set HttpReq = CreateObject("Microsoft.XMLHTTP") Set oHtml = New HTMLDocument Set IE = CreateObject("InternetExplorer.Application") With ActiveDocument.Range For Each Tbl In .Tables With Tbl For i = 1 To .Rows.Count With .Cell(i, 2).Range If .Hyperlinks.Count > 0 Then MsgBox .Hyperlinks(1).Address HttpReq.Open "GET", .Hyperlinks(1).Address, False HttpReq.send oHtml.body.innerHTML = HttpReq.responseText MsgBox HttpReq.responseText StrTxt = oHtml.getElementsByClassName("claim").Item.innerHTML With IE .Visible = False .navigate "about:blank" .Document.body.innerHTML = StrTxt .Document.execCommand "SelectAll" .Document.execCommand "Copy" End With With Tbl.Cell(i, 5).Range Selection.PasteAndFormat (wdPasteDefault) End With End If .Collapse wdCollapseEnd .Find.Execute End With Next End With Next End With Set HttpReq = Nothing Application.ScreenUpdating = True End Sub Can we by default allow access to internet explorer so that it doesn't popup everytime? Last edited by PRA007; 12-02-2015 at 09:18 AM. |
#4
|
||||
|
||||
![]()
In above code, one of problem is with Selection.PasteAndFormat (wdPasteDefault).
It doesn't go to specific location but goes to colum which are selected. How to pate range to specific location in word? |
#5
|
||||
|
||||
![]()
this works perfect
Code:
Set rng = Tbl.Cell(i, 5).Range rng.Collapse wdCollapseStart rng.PasteAndFormat wdPasteDefault |
![]() |
Tags |
macro, website, word 2010 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Extract VBA code to save in Word document | Dave T | Word VBA | 4 | 01-26-2015 08:41 PM |
![]() |
Maxwell314 | Excel | 3 | 12-08-2014 06:17 PM |
![]() |
iliauk | Word | 3 | 11-08-2013 04:37 PM |
Is there a way to extract various text in Word? | barnkeeper410 | Word | 4 | 07-08-2013 10:58 PM |
![]() |
donlincolnmsof | Word VBA | 12 | 06-19-2012 05:21 PM |