X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> VBA To Copy Part Of A Web Page?, Internet Explorer 9    
post Jun 10 2014, 06:28 PM

Posts: 776
Joined: 23-May 11

I'm using VBA through Word to try to copy a part of a web page. I can get the specific div of the web page in my code. But when I pull the text into the document, it's all completely unformatted.
'd like to see if there's any way I can copy this div in the web page as it's formatted. I know if I manually select it with the mouse and Copy, I can Paste and get all the formatting. Can I mimic this in VBA?
strCheck = "http://www.MyWebPage.com/"
Set objIE2 = GetIE(strCheck)
Set docIE = objIE2.Document
For x = 0 To docIE.getElementsByTagName("div").Length - 1
  Set objMyDiv = docIE.getElementsByTagName("div")(x)
  If Left(objMyDiv.ClassName, 16) = "passage version-" Then
    Exit For
  End If
Next x
Go to the top of the page
post Jun 17 2014, 05:37 PM

UdderAccess Admin + UA Ruler
Posts: 19,556
Joined: 27-April 02
From: Upper MI

See if this article is of any value.
hope this helps hat_tip.gif
Go to the top of the page

Custom Search
RSSSearch   Top   Lo-Fi    22nd March 2018 - 06:34 AM