Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2005

Tip: Looking for answers? Try searching our database.

Searching web sites using VBA - possible?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ed - 06 Jul 2005 23:57 GMT
I have a list of web sites down a table column.  These are all web-based
suppliers
for specialty products.  I'd like to be able to put one or more key words
into a UserForm and have a macro iterate down the list, performing a search
of each site for the product.  Kind of like limiting Google/Froogle to a few
chosen sites.

I am passably competent in VBA.  I know nothing about web sites, except that
they can contain many pages.  Is what I have described do-able through VBA?

Ed
Anand.V.V.N - 07 Jul 2005 07:58 GMT
Hi Ed,
Using the activedocument.followhyperlink you can do what you want.
You can write a loop in which you access the table cell data, using
followhyperlink method you can pass the search string.

Is this what you were lookign for?
I hope it works.

Signature

"Who will guard the guards?"

> I have a list of web sites down a table column.  These are all web-based
> suppliers
[quoted text clipped - 7 lines]
>
> Ed
Ed - 07 Jul 2005 14:50 GMT
I set that up real quick and got a run-time error 432: "File name or class
name not found during Automation operation."  Any suggestions?
Ed

> Hi Ed,
> Using the activedocument.followhyperlink you can do what you want.
[quoted text clipped - 15 lines]
> >
> > Ed
Anand.V.V.N - 07 Jul 2005 15:10 GMT
Hi Ed,
If you could post the code it would me helpful to debug.

Anand

Signature

"Who will guard the guards?"

> I set that up real quick and got a run-time error 432: "File name or class
> name not found during Automation operation."  Any suggestions?
[quoted text clipped - 24 lines]
> > >
> > > Ed
Ed - 07 Jul 2005 16:17 GMT
All I had was:

Dim strLink As String
strLink = "www.tmyers.com"

ActiveDocument.FollowHyperlink _
   Address:=strLink, _
   NewWindow:=True

Ed

> Hi Ed,
> If you could post the code it would me helpful to debug.
[quoted text clipped - 29 lines]
> > > >
> > > > Ed
Jean-Guy Marcil - 07 Jul 2005 16:58 GMT
Ed was telling us:
Ed nous racontait que :

> All I had was:
>
[quoted text clipped - 4 lines]
>    Address:=strLink, _
>    NewWindow:=True

You need to specify the type of protocol:

Const strLink As String = "http://www.tmyers.com"

ActiveDocument.FollowHyperlink _
   Address:=strLink, _
   NewWindow:=True

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Ed - 07 Jul 2005 17:28 GMT
Thank you, Jean-Guy!  The link now works.  Now I wonder if the rest of what
I desire is also possible.  From my original post:
-------------
I have a list of web sites down a table column.  These are all web-based
suppliers
for specialty products.  I'd like to be able to put one or more key words
into a UserForm and have a macro iterate down the list, performing a search
of each site for the product.  Kind of like limiting Google/Froogle to a few
chosen sites.

I am passably competent in VBA.  I know nothing about web sites, except that
they can contain many pages.  Is what I have described do-able through VBA?
---------------

I can do the UserForm and pass the  inputs into strings to use in the code.
But can I make a search of an entire web site through VBA like this?  Or
will it take a much greater understanding of VBA and / or web sites to do
this?  What do you think?

Ed

> Ed was telling us:
> Ed nous racontait que :
[quoted text clipped - 15 lines]
>     Address:=strLink, _
>     NewWindow:=True
Jean-Guy Marcil - 07 Jul 2005 19:23 GMT
Ed was telling us:
Ed nous racontait que :

> Thank you, Jean-Guy!  The link now works.  Now I wonder if the rest
> of what I desire is also possible.  From my original post:
[quoted text clipped - 14 lines]
> this?  Or will it take a much greater understanding of VBA and / or
> web sites to do this?  What do you think?

I am not an expert in manipulating web sites programmatically, but I do not
think you can manipulate a Web site (like searching it) through the Word
Object Model. You may have to go through scripting or the IE Object Model.

Try posting in one of the IE newsgroups like
   microsoft.public.windows.inetexplorer.ie5.programming
   microsoft.public.windows.inetexplorer.ie55.programming.general
etc.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Ed - 07 Jul 2005 20:01 GMT
 I will go there. Thank you for all your help.
Ed

> Ed was telling us:
> Ed nous racontait que :
[quoted text clipped - 26 lines]
>     microsoft.public.windows.inetexplorer.ie55.programming.general
> etc.
Jonathan West - 13 Jul 2005 19:50 GMT
Hi ed,

An alternative might be to make use of Karl Peterson's Slurp sample

http://vb.mvps.org/samples/project.asp?id=Slurp

It is written in VB6, but it should be quite straightforward to convert it
to VBA.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

>  I will go there. Thank you for all your help.
> Ed
[quoted text clipped - 31 lines]
>>     microsoft.public.windows.inetexplorer.ie55.programming.general
>> etc.
Ed - 14 Jul 2005 14:40 GMT
Hi, Jonathan.  Thanks for the tip.  I'll check it out.
Ed

> Hi ed,
>
[quoted text clipped - 4 lines]
> It is written in VB6, but it should be quite straightforward to convert it
> to VBA.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.