Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Importing Web Page Source Code


Hi

I know you can open a web page into Excel by simply entering a web
address. But is there a way to tell Excel to import the source code
instead?

Thx


--
tx12345
------------------------------------------------------------------------
tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=503702

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Importing Web Page Source Code

You can use an xmlhttp object instead if what you want is the source

Sub Tester()
MsgBox GetSource("http://www.google.com")
End Sub


Function GetSource(sURL As String) As String

Dim oXHTTP As Object

Set oXHTTP = CreateObject("MSXML2.XMLHTTP")
oXHTTP.Open "GET", sURL, False
oXHTTP.send
GetSource = oXHTTP.responsetext
Set oXHTTP = Nothing

End Function


Tim


"tx12345" wrote in
message ...

Hi

I know you can open a web page into Excel by simply entering a web
address. But is there a way to tell Excel to import the source code
instead?

Thx


--
tx12345
------------------------------------------------------------------------
tx12345's Profile:
http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=503702



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Importing Web Page Source Code


That is a very nice bit of code. But what happens is a dialogue box pops
up with the source, and then after I click OK it goes away and never
gets into the worksheet.

Is there a way for the data to flow into the worksheet?


Many thanks

tx


--
tx12345
------------------------------------------------------------------------
tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=503702

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Importing Web Page Source Code

tim was just giving you an example using the message box, but you didn't
state what you were doing with it or where you wanted it,

if you want it in a1
change
MsgBox GetSource("http://www.google.com")


to
Range("a1").Value = GetSource("http://www.google.com")

--


Gary


"tx12345" wrote in
message ...

That is a very nice bit of code. But what happens is a dialogue box pops
up with the source, and then after I click OK it goes away and never
gets into the worksheet.

Is there a way for the data to flow into the worksheet?


Many thanks

tx


--
tx12345
------------------------------------------------------------------------
tx12345's Profile:
http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=503702



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Importing Web Page Source Code


Hi Gary. Yes, that works, thank you.

What happens, though, is as much source as can be dumped into one cell
gets stuffed into A1, but somewhere down the middle of the source the
rest of it gets cut off.

Is there a way to get the import of the source to come in with the
carriage returns/line breaks?

If you import a web page, it fills up a1 to a1000 (or whatever), and
from there you can process the data, but if everything is in one cell
makes it more of a challenge.

Many Thx!

tx


--
tx12345
------------------------------------------------------------------------
tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=503702



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Importing Web Page Source Code


I came up with a solution (a hack)

open the source in a new file, then save it as a text file, then
re-open it and that shows the entire page. Apparently ithe page
contents are not cut off, just what excel can display inside of one
cell.

I did learn one thing: if you have text encapsulated with " " you can
fit a lotta text into one cell! The source comes in "<html ...
</html" If there is a way to get rid of the incoming quotes, I could
skp the hack I came up with, but if not i am still very apprecitive of
the tip.

As usual, everyone that helps me out gets a free copy of the file. -
you might not want it though, lol

Thanks again

tx


--
tx12345
------------------------------------------------------------------------
tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=503702

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove headers when importing from an external source? e-Learning Excel Worksheet Functions 1 March 10th 10 08:16 PM
Importing Alan Beban's code on Arrays; Importing a module or a project Steve G Excel Worksheet Functions 4 August 27th 07 04:18 PM
Importing Selected Source Book Data Greyson Excel Discussion (Misc queries) 3 December 20th 05 03:02 PM
Viewing source code when saved as web page Mark Excel Discussion (Misc queries) 1 March 31st 05 06:26 AM
Importing data from external source Squid[_2_] Excel Programming 0 January 21st 04 02:59 PM


All times are GMT +1. The time now is 02:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"