Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Challenge - Excel Line Feed Character CHR(10) - How to Delete and keep the text formatting without going ro single line in a cell ? No Name Excel Worksheet Functions 7 October 7th 09 11:10 AM
how to remove dotted line with words chart area from around chart desof Charts and Charting in Excel 2 May 13th 09 10:18 PM
average Line created in an existing line graph- based on one cell Melanie Charts and Charting in Excel 2 December 27th 07 09:14 PM
How do I delete a few words from a line of text? lauras03 Excel Worksheet Functions 3 February 16th 07 06:20 PM
Excel pie chart title words break to next line between letters? sweetsweed Charts and Charting in Excel 0 October 9th 06 07:10 PM


All times are GMT +1. The time now is 10:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"