473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

search a word in html file

198 100+
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 1554
VijaySofist
107 100+
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 100+
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 100+
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 100+
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 100+
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 100+
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 100+
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
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:...
1
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,...
6
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...
2
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
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......
3
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...
1
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...
1
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...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.