473,770 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

search a word in html file

198 New Member
Hi!
i am making a program in which i want to search a particular word in html file
and if word found save it into excel file with html file name
e.g
i want to search a string "visual" in a.html file and if found then this string is transfered into excel file with html file name

please give some idea
thanks in advance
varinder
Mar 24 '08 #1
7 1570
VijaySofist
107 New Member
Hi varinder!

You can Use the Instr function for this purpose.

For Example Consider the following Example Code
Expand|Select|Wrap|Line Numbers
  1. If InStr(1,YourHtmlFileContent, "visual" ,vbTextCompare) > 0 Then
  2.      'Your Operational Code
  3. End If
  4.  
All The Best

Thanks and Regards
Vijay.R
Mar 24 '08 #2
veer
198 New Member
Thanks for reply
can i put my file name just like this

If InStr(1,a.html, "visual" ,vbTextCompare) > 0 Then
'Your Operational Code
End If

actually i don't want to open the file and show the contents
actually i have a folder in which more than one files are stored and i want to search a single string in all the files




Hi varinder!

You can Use the Instr function for this purpose.

For Example Consider the following Example Code
Expand|Select|Wrap|Line Numbers
  1. If InStr(1,YourHtmlFileContent, "visual" ,vbTextCompare) > 0 Then
  2.      'Your Operational Code
  3. End If
  4.  
All The Best

Thanks and Regards
Vijay.R
Mar 24 '08 #3
VijaySofist
107 New Member
Thanks for reply
can i put my file name just like this

If InStr(1,a.html, "visual" ,vbTextCompare) > 0 Then
'Your Operational Code
End If

actually i don't want to open the file and show the contents
actually i have a folder in which more than one files are stored and i want to search a single string in all the files
Hi!

First Read the HTML file contents and Store it in a String VAriable. Then Substitute the String Variable in the above said code in place of "a.html"


All The Best

Thanks and Regards
Vijay. R
Mar 24 '08 #4
veer
198 New Member
thanks for reply
can you give me some programing help and also i want to know is there any liberary refrence is required for opening html file like doc or excel file

thanks in advance


Hi!

First Read the HTML file contents and Store it in a String VAriable. Then Substitute the String Variable in the above said code in place of "a.html"


All The Best

Thanks and Regards
Vijay. R
Mar 24 '08 #5
VijaySofist
107 New Member
thanks for reply
can you give me some programing help and also i want to know is there any liberary refrence is required for opening html file like doc or excel file

thanks in advance
Hi veer!

You can open a html file just like a text file.

The Syntax for opening a text file is
Expand|Select|Wrap|Line Numbers
  1. Dim CompContent  as String
  2. CompContent = ""
  3. Open "D:\Test.html" For Input As #1
  4. CompContent = Input$(LOF(1), #1)
  5. Close #1
  6.  

In the above example code Test.html is my File Name. You can use your file Name instead of my file name here(with your file path). Now the full Content of that file will be available in the CompContent variable

All the Best

Thanks and Regards
Vijay.R
Mar 25 '08 #6
veer
198 New Member
Hi
it works but when special character like "ö,ä "come
this programe does not works
Hi veer!

You can open a html file just like a text file.

The Syntax for opening a text file is
Expand|Select|Wrap|Line Numbers
  1. Dim CompContent  as String
  2. CompContent = ""
  3. Open "D:\Test.html" For Input As #1
  4. CompContent = Input$(LOF(1), #1)
  5. Close #1
  6.  

In the above example code Test.html is my File Name. You can use your file Name instead of my file name here(with your file path). Now the full Content of that file will be available in the CompContent variable

All the Best

Thanks and Regards
Vijay.R
Apr 25 '08 #7
VijaySofist
107 New Member
Hi
it works but when special character like "ö,ä "come
this programe does not works
Hi Veer!

For these type of problems, you can use some external Controls which reads the HTML File Content. For example there is a control named AllText Control which reads the HTML File Content as it is. Try those type of controls in your Project.

All the Best

With Regards
Vijay. R
Apr 25 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

10
39357
by: Anand Pillai | last post by:
To search a word in a group of words, say a paragraph or a web page, would a string search or a regexp search be faster? The string search would of course be, if str.find(substr) != -1: domything() And the regexp search assuming no case restriction would be,
1
8728
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast, returned the hyperlinked page title, filename, and the body txt (30 preceding and following words) in context with the search word highlighted. Excellent.! See it working at: http://www.ipt.co.za Just search for "firearm"
6
7775
by: bear220720 | last post by:
I have a big problem about how to make this C++ program. I was asked to use binary search tree to built a dictionary. This program must have some function, 1. Read a article file and include every word of it into the dictionary. 2. When enter a word, it can make a search and report the word where the search eventually stops. If anyone has this kind of program, please send to me. Thank you!
2
2517
by: Diana | last post by:
Hello. I need to search and extract the subject of a txt file. Is this do-able? Could you show me a sample code? Thanks very much!
3
15022
by: erwinschrijver | last post by:
Is it possible to search inside a PDF-flie, using PHP? Same question for MS Word documents? Searched for it, but I cannot find anything about it, there are also no PEAR-packages available... anyone?
3
9559
by: Chung Leong | last post by:
Here's the rest of the tutorial I started earlier: Aside from text within a document, Indexing Service let you search on meta information stored in the files. For example, MusicArtist and MusicAlbum let you find MP3 and other music files based on the singer and album name; DocAuthor let you find Office documents created by a certain user; DocAppName let you find files of a particular program, and so on. Indexing Service uses plug-ins...
1
2769
by: HYRY | last post by:
I want to add some simple search function for my homepage. It need to search through all the html files of my homepage (about 300 pages), and highlight the search words. I made some test with HTMLParser, it works but slow. So, my question is how can I improve its speed? from HTMLParser import HTMLParser class HightLightParser(HTMLParser):
1
4659
by: amiparna | last post by:
There is two frame in my form.In d first frame there is a text box,and i give some word in the text box.I want to search the word from a file from the location(http://45.12.09.31...........) and if the word is found any file of that location, the file will display in second frame. main problem is arise in the following line. txt = s.document.body.createTextRange(); here the code is : <html>
5
1877
by: silmana | last post by:
Hi i have this script that i want to use as php or html but i cant find the problem, could anyone solve the problem, i dont know why i cannot use it in php or html file // OBS! Några saker måste justeras för att skriptet skall fungera // 1) Du måste ange antal webbsidor som skall genomsökas // 2) Du måste lista dessa webbsidor // 3) Du måste justera variabeln mode (1= visa title, 2=visa länkar, // ...
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10037
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8931
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.