Click to See Complete Forum and Search --> : HTMLDocument


Joselito
January 26th, 2000, 09:01 AM
Hi,

I wanted to do something really simple in VB using HTMLDocument. What I wanted to do was to retrieve the title of a URL. What would be the easiest way to do this using HTMLDocument. Example below:

...

Set inet = New HTMLDocument

inet.open "http://www.codeguru.com"

Title.Text = inet.Title

inet.Close ...


I'm not sure about the third line, I have an edit box on my form called title, and I wanted to set the text to whatever the title of the URL was. If you can help me out, I'd really appreciate it.

TIA, -Lito

Lothar Haensler
January 26th, 2000, 10:48 AM
here is a working sample

Dim h as new HTMLDocument
w.navigate "http://yourURLGoesHere"
set h = w.document
MsgBox h.Title



w is the name of a Web Browser control

Joselito
January 26th, 2000, 01:19 PM
Just exactly what is "w"?

Lothar Haensler
January 27th, 2000, 01:05 AM
did you really read my post?
>w is the name of a Web Browser control

That's what it is: the name of a Web Browser control that I placed on the form -> Project/components/Microsoft Internet Controls

Johnny101
January 27th, 2000, 02:21 PM
Is there some other reference that I have to set for this code to work? I keep getting the lovely User-defined type not defined on the New HTMLDocument. I already have the Internet Controls checked in both the references and components. Any suggestions?

Thanks,
John

John Pirkey
MCSD
www.ShallowWaterSystems.com

Johnny101
January 27th, 2000, 02:54 PM
Nevermind, hehehe, typo.

it happens to everyone. (shrug)

John

John Pirkey
MCSD
www.ShallowWaterSystems.com