If using FP2003, publish the site to another location and enable all the Optimize HTML options which
will remove all Webbot related code, etc.
--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WebMaster Resources(tm)
http://www.ycoln-resources.com
FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
"Dai" <(E-Mail Removed)> wrote in message
news:0EF1690B-6AF5-4F01-85D1-(E-Mail Removed)...
> Hi,
>
> I'm trying to automate a find and replace which strips out the Frontpage
> extensions to provide a copy of a web-site for a customer. My program works
> when it comes to removing forms but not when I try to remove certain pieces
> of text outside those forms. I've included the complete piece of code below.
> The strQuery works but the strRating query does not - at least not inside
> the code, it works as a standalone normal Frontpage query. Can anyone see
> what is wrong with it? Thanks
>
> Here's the complete code, feel free to copy and use it yourselves:
>
> Public objFile As webFile
>
> Public objApp As FrontPage.Application
>
> Public objPageWindow As PageWindowEx
>
> Public objHead As IHTMLElement
>
> Public objSearch As SearchInfo
>
> Public objRange As IHTMLTxtRange
> Public objLimits As IHTMLTxtRange
>
> Public strQuery As String
> Public strRating As String
>
> Public intFilesCount As Integer
> Public intFC As Integer
>
> Public blnFoundMatch As Boolean
>
> Sub RemovingTheFormsAndRatings()
>
> Set objApp = FrontPage.Application
> intFC = 0
>
> '
> ' Set up the Form code search string
> '
> strQuery = "<?xml version=""1.0""?>" & _
> "<fpquery version=""1.0"">" & _
> "<queryparams regexp=""true"" inhtml=""true"" />" & _
> "<find tag=""form"">" & _
> "</find>" & _
> "<replace type=""removeTagAndContents"" />" & _
> "</fpquery>"
>
> '
> ' Set up the Rating code search string
> '
> strRating = "<?xml version=""1.0""?>" & _
> "<fpquery version=""1.0"">" & _
> "<queryparams regexp=""true"" inhtml=""true"" />" & _
> "<find tag=""a"">" & _
> "<rule type=""attribute"" attribute=""name"" compare=""=""
> value=""rate"" />" & _
> "</find>" & _
> "<replace type=""removeTagAndContents"" />" & _
> "</fpquery>"
>
> '
> 'Create a reference to the webFiles collection.
> '
>
> intFilesCount = objApp.ActiveWeb.AllFiles.Count
>
> For Each objFile In objApp.ActiveWeb.AllFiles
> If objFile.Extension = "htm" Or objFile.Extension = "html" Then
> objFile.Open
> Set objPageWindow = ActivePageWindow
> Set objPage = objPageWindow.Document
> '
> ' Replace the code for the Rating if it exists
> '
> Set objSearch = Application.CreateSearchInfo
>
> objSearch.Action = fpSearchFindTag
> objSearch.QueryContents = strRating
>
> Do
> blnFoundMatch = Application.ActiveDocument.Find(objSearch,
> objLimits, objRange)
> Loop While blnFoundMatch = True
>
> '
> ' Find and replace the code for the form if it exists
> '
> Set objRange = ActiveDocument.body.createTextRange
> Set objLimits = ActiveDocument.body.createTextRange
> Set objSearch = Application.CreateSearchInfo
>
> objSearch.Action = fpSearchFindTag
> objSearch.QueryContents = strQuery
> Do
> blnFoundMatch = Application.ActiveDocument.Find(objSearch,
> objLimits, objRange)
> Loop While blnFoundMatch = True
>
>
> 'Now save and close the page window.
>
> objPageWindow.SaveAs objPageWindow.Document.Url
> objPageWindow.Close False
> End If
> If intFC < intFilesCount Then
> intFC = intFC + 1
> Else
> Exit For
> End If
> Next objFile
>
> End Sub
>
>