PuppyOnTheRadio Posted June 14, 2012 Share Posted June 14, 2012 Hey. I posted something at http://w3schools.invisionzone.com/index.php?showtopic=43927 that I need help with. I was looking for a VBS solution to delete lines of an XML doc (as though it were a text file) based upon lines above and below.It seems like a fairly straightforward idea, but I'm not that fantastic at VBS and thought someone may be able to work out a quicker way of doing this than I can. Link to comment Share on other sites More sharing options...
PuppyOnTheRadio Posted June 15, 2012 Author Share Posted June 15, 2012 Okay - I've played with this in excel and VBA and have the bones of a script: Sub Macro1() Application.ScreenUpdating = False Do If InStr(ActiveCell.Value, "<timestamp>") > 0 Then If Mid(ActiveCell.Value, 18, 4) < 2010 Then Do ActiveCell.Offset(-1, 0).Select Loop Until InStr(ActiveCell.Value, "<revision>") > 0 Do Selection.Delete Shift:=xlUp Loop Until InStr(ActiveCell.Value, "</revision>") > 0 Selection.Delete Shift:=xlUp Else ActiveCell.Offset(1, 0).Select End If Else If InStr(ActiveCell.Value, "<siteinfo>") > 0 Then Do Selection.Delete Shift:=xlUp Loop Until InStr(ActiveCell.Value, "</siteinfo>") > 0 Selection.Delete Shift:=xlUp Else ActiveCell.Offset(1, 0).Select End If End If Loop Until InStr(ActiveCell.Value, "</mediawiki>") > 0 Application.ScreenUpdating = TrueEnd Sub I'd like to do the same with a VBS that will also: Open the XML as though it were a text file work on a line-by-line basis instead of a cell by cell basis Who can bail me out here? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now