Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get certain words from a line into a cell
Hello
Just hoping someone can send me in the right direction here with a method that might work here. I am extracting data from text files based on finding a certain word. If found, the whole line in the text doc will be pasted into a row in excel. There are certain things in these rows like just the web address, or page title, that I want in the Excel doc rather than the entire line. Would this be parsing usign tokens or something? Any help or pointers would be great! Thanks a lot Mark |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get certain words from a line into a cell
On Apr 17, 9:48 am, Mark wrote:
Hello Just hoping someone can send me in the right direction here with a method that might work here. I am extracting data from text files based on finding a certain word. If found, the whole line in the text doc will be pasted into a row in excel. There are certain things in these rows like just the web address, or page title, that I want in the Excel doc rather than the entire line. Would this be parsing usign tokens or something? Any help or pointers would be great! Thanks a lot Mark Try with something like this: Sub GetTitle() Dim sLine As String, iStart As Integer, iEnd As Integer, cTitle As String sLine = "<head id=ctl00_ctl00_Head1<base href=http:// www.sqlteam.com/default.aspx /<meta http-equiv=Content-Type content=text/html; charset=utf-8 /<link rel=SHORTCUT ICON href=http:// www.sqlteam.com/favicon.ico /<link rel=alternate type=application/rss +xml title=SQLTeam.com -- SQL Server Information href=http:// feeds.sqlteam.com/sqlteam /<titleGenerating ADO Parameters with Information Schema Views - SQLTeam.com</title<link rel=stylesheet href=sqlteam2.css type=text/css /<link rel=stylesheet href=csharp.css type=text/css /" iStart = InStr(1, sLine, "<title", vbBinaryCompare) + Len("<Title") iEnd = InStr(1, sLine, "</title", vbBinaryCompare) cTitle = Mid(sLine, iStart, iEnd - iStart) MsgBox cTitle, , "Title" End Sub This extracts the page title, something similar can be done to extract the url. notice that the line used is not a valid html text, all double quotes have been removed to show the example. source of example: http://www.sqlteam.com/article/gener...n-schema-views HTH Jaime Vasquez |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get certain words from a line into a cell
It is kind of hard to give you code without more information. Can you show
us a (real) sample of text from the text file and the words you would be looking for and the parts you want extracted? Rick "Mark" wrote in message ... Hello Just hoping someone can send me in the right direction here with a method that might work here. I am extracting data from text files based on finding a certain word. If found, the whole line in the text doc will be pasted into a row in excel. There are certain things in these rows like just the web address, or page title, that I want in the Excel doc rather than the entire line. Would this be parsing usign tokens or something? Any help or pointers would be great! Thanks a lot Mark |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Challenge - Excel Line Feed Character CHR(10) - How to Delete and keep the text formatting without going ro single line in a cell ? | Excel Worksheet Functions | |||
how to remove dotted line with words chart area from around chart | Charts and Charting in Excel | |||
average Line created in an existing line graph- based on one cell | Charts and Charting in Excel | |||
How do I delete a few words from a line of text? | Excel Worksheet Functions | |||
Excel pie chart title words break to next line between letters? | Charts and Charting in Excel |