Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 05-21-2009, 06:09 AM
whousedmy whousedmy is offline
Registered User
 
Join Date: 08 May 2009
Location: Singapore But in China now
MS Office Version:Excel 2007
Posts: 25
whousedmy is becoming part of the community
Extract text from String using any software

Please Register to Remove these Ads

Hi All & Good Day,

I'm student doing my attachment. I've encounter this problem and I really need some help here.
Please kindly help or share any knowlegde if u can. I will be very greatful for any help given. THanks a million in adv.

Problem:

I've this junk of code and what i need to extract is the ItemID after swItem= but there main problem here is i only need the first part which highlight in blue.

Therefore i'm wondering if it's possible to write a VBA which will find the HTML tag

<aclass="udrlinesmall then extract the inform within the which wildcard happen to be <XXXXXXXXXX> and inside the wildcard find the second wildcard which is swItem= then extract the ItemID = "MTX-c380636094ed4c24a5a22b6542" and paste in in a new doc or at the bottom of the doc.

*NOTE : There is more then "swItem=" therefore it need to be inside the <aclass="udrlinesmall xxxxx....> tag

Really thanks everyone in adv. This will be great different in my grade for attachment pls kindly help if can. THANK YOU!

Code:
<trbgColor=#e7e7e7>
<tdalign="left"><aclass="udrlinesmall" href="SoftwareDescription.jsp?lang=en&cc=us&prodTypeId=15351&prodSeriesId=1121474&prodNameId=3279719&swEnvOID=4026&swLang=8&mode=2&taskId=135&swItem=MTX-c380636094ed4c24a5a22b6542">Citrix XenServer Hot Fix
</a></td>
<tdclass="small" align="left">4.1.0-11501<br>19 Nov 2008</td>
<tdclass="small" align="left">282.8</td>
<tdclass="small" align="left">56K: >8h<br>512K: 1h</td>
<tdclass="small" align="left"><ahref="SoftwareDescription.jsp?lang=en&cc=us&prodTypeId=15351&prodSeriesId=1121474&prodNameId=3279719&swEnvOID=4026&swLang=8&mode=2&taskId=135&swItem=MTX-772f8a7295c0448c9f333f9d9a" class="udrline">4.1.0-9514</a><br>15 Jul 2008</td>
<tdalign="left"><formaction="SoftwareDownloadEventHandler.jsp?redirectReason=SWD_FTP_Request&swItem=MTX-c380636094ed4c24a5a22b6542&prodSeriesId=1121474&prodLine=SY&targetPage=ftp%3A%2F%2Fftp.hp.com%2Fpub%2Fsoftlib2%2Fsoftware1%2Fpubsw-windows%2Fp702010714%2Fv50434/hpxs-hotfix-11501-b1.zip&filesize=296496139" method="post"><inputclass="primButton" type="submit" value="Download&nbsp;&raquo;" name="download" style="float:left;" title="Download" onclick='if(window.s_gs){s_linkType="d";s_lnk=s_co(this);s_linkName="SY-hpxs-hotfix-11501-b1.zip";s_prop2="SY";s_prop4="SOAR-MTX-c380636094ed4c24a5a22b6542";s_prop5="1121474-HP ProLiant ML370 G5 Server series";s_gs("hphqglobal,hphqWWsupportBSD")}'"/></form></td>
</tr>
</table>
__________________
Noobie here to LEARN
Reply With Quote
  #2  
Old 05-21-2009, 11:46 PM
whousedmy whousedmy is offline
Registered User
 
Join Date: 08 May 2009
Location: Singapore But in China now
MS Office Version:Excel 2007
Posts: 25
whousedmy is becoming part of the community
Re: Extract text from String using any software

anyone? any suggestion?
__________________
Noobie here to LEARN
Reply With Quote
  #3  
Old 05-22-2009, 04:30 AM
DonkeyOte's Avatar
DonkeyOte DonkeyOte is offline
Forum Guru
 
Join Date: 22 Oct 2008
Location: Suffolk, UK
MS Office Version:2002 & 2007
Posts: 13,544
DonkeyOte has a reputation beyond repute DonkeyOte has a reputation beyond repute DonkeyOte has a reputation beyond repute DonkeyOte has a reputation beyond repute DonkeyOte has a reputation beyond repute DonkeyOte has a reputation beyond repute DonkeyOte has a reputation beyond repute DonkeyOte has a reputation beyond repute DonkeyOte has a reputation beyond repute DonkeyOte has a reputation beyond repute DonkeyOte has a reputation beyond repute
Re: Extract text from String using any software

Could you post a sample file - it's quite hard to follow where the data is located what your desired output is etc...

In VBA terms you could possibly look at Regular Expressions and or the simpler Split method, ie:

Code:
Dim strHTML As String, strOutput As String, lngString As Long, vString
strHTML = your HTML string...
vString = Split(strHTML,"&")
You can iterate through vString until such time as the value is the swItem variable, eg:

Code:
For lngString = LBound(vString) To UBound(vString) Step 1
    If InStr(vString(lngString), "swItem=") Then
        strOutput = Split(vString(lngString), "=")(1)
        Exit For
    End If
Next lngString
EDIT: Doh - I didn't see this was in Word ... apologies...

Last edited by DonkeyOte; 05-22-2009 at 04:32 AM.
Reply With Quote
  #4  
Old 05-22-2009, 04:56 AM
whousedmy whousedmy is offline
Registered User
 
Join Date: 08 May 2009
Location: Singapore But in China now
MS Office Version:Excel 2007
Posts: 25
whousedmy is becoming part of the community
Re: Extract text from String using any software

Is ok with excel also.. actually it's a HTML file.. i'm using it source to extract the link.

Here the sample

http://www.easy-share.com/1905311225/PLease_Help.rar
__________________
Noobie here to LEARN

Last edited by whousedmy; 05-22-2009 at 05:49 AM.
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Forum Jump