Selecting Webpage content

msnniyasu

New Member
Joined
Mar 9, 2014
Messages
11
Dear All:
<o:p> </o:p>
I’m using the following code for extracting contents from my company webpage. The web content is originally created in MS excel and saved as html file and upload to the company site.
<o:p> </o:p>
Recently I found out that, the webpage page content is not getting copied to the excel file and throwing an error always (Run-time error: 1004 Method "Paste" of object "_Worksheet" failed.). Later I understood that, the selection of webpage content is not happening and that causes the error
<o:p> </o:p>
I also learned that, previously once the webpage is loaded, I could directly use Ctrl+A to select the entire content and now it require to click somewhere in the webpage before I use Ctrl+A
<o:p> </o:p>
Im using Excel ver: 97-2003 and OS: Win XP
<o:p> </o:p>
I need your help to solve the following issues
<o:p> </o:p>

  1. How to automate the clicking in the webpage (or a different solution) so that the selection and copying will run smoothly
<o:p> </o:p>

  1. This code is not working in excel 2007 and how to make it compatible for excel 2007. I’m getting following error while running the code in Excel 2007
<o:p> </o:p>
(Run-time Error -2147417848 (80010108) Automation error the object invoked has disconnected from its clients). And “Do Until IE.ReadyState = 4” is being highlighted while debug
<o:p> </o:p>
I believe company webpage can’t be opened outside the company network

Rich (BB code):
Rich (BB code):
Rich (BB code):
Rich (BB code):
Sub extract ()<o:p></o:p>
<o:p> </o:p>
Application.DisplayAlerts = False<o:p></o:p>
<o:p> </o:p>
Dim IE As Object<o:p></o:p>
Set IE = CreateObject("InternetExplorer.Application")<o:p></o:p>
     <o:p></o:p>
IE.Navigate "http://www.xps.org/new/wiw/english/br.htm" <o:p></o:p>
IE.Visible = False<o:p></o:p>
<o:p> </o:p>
Do Until IE.ReadyState = 4: DoEvents: <st1:place w:st="on">Loop</st1:place> 'READYSTATE_COMPLETE<o:p></o:p>
Do While IE.Busy: DoEvents: <st1:place w:st="on">Loop</st1:place><o:p></o:p>
<o:p> </o:p>
IE.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT<o:p></o:p>
IE.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT<o:p></o:p>
<o:p> </o:p>
Sheet1.Activate
Sheet1.Range("A1:K1000").ClearContents<o:p></o:p>
Sheet1.Range("A1").Select<o:p></o:p>
Sheet1.PasteSpecial Format:="HTML", link:=False, DisplayAsIcon:=False<o:p></o:p>
IE.Quit<o:p></o:p>
<o:p> </o:p>
End Sub


Thanks in advance
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top