Attribute VB_Name = "Module_makeVBScript" ' makeVBScript - VBScript to Document.Write the Page HTML. ' Copyright (C) 2002 Stephen C. Travis ' ' This program is free software; you can redistribute it and/or modify ' it under the terms of the GNU General Public License as published by ' the Free Software Foundation; either version 2 of the License, or ' (at your option) any later version. ' ' This program is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY; without even the implied warranty of ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ' GNU General Public License for more details. ' ' You should have received a copy of the GNU General Public License ' along with this program; if not, write to the Free Software ' Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ' or visit their website at http://www.fsf.org/licenses/gpl.txt ' Sub makeVBScript() If Not FrontPage.ActiveDocument Is Nothing Then If FrontPage.ActivePageWindow.ViewMode = fpPageViewNormal Then Dim newLine, waitTime, strResult, objHTML, strHTML, arLines, strLine, oWS, sTime newLine = vbCr waitTime = 4 'seconds strResult = "" Set objHTML = Application.ActiveDocument.all.tags("html") strHTML = objHTML(0).outerHTML arLines = Split(strHTML, vbCrLf) For Each strLine In arLines If strLine <> "" Then strResult = strResult & "Response.Write """ & Replace(strLine, """", """""") & """ & vbCrLf" & newLine Next Set oWS = CreateObject("WScript.Shell") If Not (oWS.AppActivate("Untitled")) Then oWS.Run "Notepad.exe" sTime = Timer Do If Timer - sTime > waitTime Then MsgBox ("Notepad failed to start in " & waitTime & " seconds." & vbCr & vbCr & "You may need to increate the waitTime variable in the macro.") Exit Do End If If oWS.AppActivate("Untitled") Then strResult = Replace(strResult, "{", "{{}") strResult = Replace(strResult, "}", "{}}") strResult = Replace(strResult, "%", "{%}") strResult = Replace(strResult, "+", "{+}") strResult = Replace(strResult, "^", "{^}") strResult = Replace(strResult, "~", "{~}") strResult = Replace(strResult, "[", "{[}") strResult = Replace(strResult, "]", "{]}") strResult = Replace(strResult, "(", "{(}") strResult = Replace(strResult, ")", "{)}") oWS.SendKeys strResult Exit Do End If Loop End If End If End Sub