Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default HTML parsing with VBA

hello, I am trying to modify a recorded macro that replaces an HTML tag

with "". The macro I recorded is below. I want to replace the 7 in the
Rows parameter with a counter, i, and use a For ..Next statement to
loop through each row in the worksheet. However, this is giving me an
app error. Does anyone know how I can do this? Thanks.

------ Original Macro -------
Sub CleanHTML()


' CleanHTML Macro
' Macro recorded 4/17/2006 by Mark Oium


Rows("7:7").Select
Selection.Replace What:="<*", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False
End Sub


------ Modified Macro ------
Sub CleanHTML()


Dim i as Integer


'CleanHTML Macro
'Macro recorded 4/17/2006 by Mark Oium


For i = 1 To 1396
Rows("i:i").Select
Selection.Replace What:="<*", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False
Next i
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default HTML parsing with VBA



For i = 1 To 1396
Rows("i:i").Select
Selection.Replace What:="<*", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False
Next i
End Sub


For i = 1 To 1396
Rows(i).Replace What:= etc.
Next i

--
Dick Kusleika
MS MVP - Excel
www.dailydoseofexcel.com


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default HTML parsing with VBA

Thhanks Dick. That worked without any errors. But now it seems as
though the macro is not searching the entire row. The file has 90
columns and up to 1400 rows. Many of the cells contain several HTML
tags and not all are being replaced with "". Also, some tags are
preceded by a few spaces, these are not being replaced either. Do you
have any advice? Thanks.

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
Stop excel from processing HTML? IE paste raw html. nick Excel Discussion (Misc queries) 2 April 21st 23 05:12 PM
Parsing Saxman[_2_] Excel Discussion (Misc queries) 3 July 30th 07 04:36 PM
Excel & HTML Parsing Porphyria Excel Discussion (Misc queries) 4 June 24th 06 12:18 AM
parsing HTML table into excel. How? Dan[_38_] Excel Programming 6 July 11th 04 10:19 AM
Parsing Data From HTML Source into Excel using VBA Peter Dickson Excel Programming 1 July 9th 03 11:00 PM


All times are GMT +1. The time now is 06:03 AM.

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

About Us

"It's about Microsoft Excel"