metatags

J

Jean Pierre Daviau

Hi every body:

I would like to add more Items to the metags Item lists in this script from
Microsoft DataBase.
Like:

ActiveDocument.all.tags("meta").Item("Reply-to").outerHTML = ""

for example.


Jean Pierre
------------
Sub myProcedure()

'Set up a variable to hold the result of a message box
Dim myMsgBoxResults As VbMsgBoxResult

'Check to see if a web is open.
If ActiveWebWindow.Web Is Nothing Then

'If no web is open, display a message box.
MsgBox "Please open a web before running this macro.", _
vbOKOnly + vbExclamation

'. . . and end the macro.
Exit Sub

End If

'//////////////////////////////////////////////////////////////////
'In order for us to update the HTML in our files, there must be no
'pages open. To check for this, we check the Count property of
'the PageWindows collection. The PageWindows collection's Count
'property is equal to the number of files that are currently open.
'//////////////////////////////////////////////////////////////////

'Get the count of the PageWindows collection
If ActiveWeb.ActiveWebWindow.PageWindows.Count <> 0 Then

'Assign the result of a message box to the variable
myMsgBoxResults = _
MsgBox("Please close all files before running this macro.", _
vbOKOnly + vbExclamation)

'If the user clicks OK in our message box, exit the macro.
'This variable will equal vbOK as soon as the user clicks
'the OK button in the message box.
If myMsgBoxResults = vbOK Then Exit Sub

End If

'Set up a variable for the WebFolder we're passing to the
'RemoveMetaTag procedure
Dim myTempFolder As WebFolder

'Set the myWebFolder variable to equal the rootfolder of
'the active web
Set myTempFolder = ActiveWeb.RootFolder

'Now call the RemoveMetaTag procedure and pass myWebFolder to it.
RemoveMetaTag myTempFolder

'Display a dialog saying we're done.
myMsgBoxResults = MsgBox _
("All Generator meta tags removed.", vbOKOnly + vbInformation)

End Sub

Sub RemoveMetaTag(myWebFolder As WebFolder)

'Set up all variables
Dim myFiles As WebFiles
Dim myFile As WebFile
Dim myFolders As WebFolders

'Set myFiles equal to the active web's Files collection
Set myFiles = myWebFolder.Files

'Set myFolders equal to the active web's Folders collection
Set myFolders = myWebFolder.Folders

'This For loop loops through each file in the root folder
For Each myFile In myFiles

'Check to see if the file is actually an ASP or HTML file.
If UCase(myFile.Extension) = "HTM" Or UCase(myFile.Extension) =
"HTML" Or UCase(myFile.Extension) = "ASP" Then

'Open the file
myFile.Open

'Set up a variable for the opened PageWindow
Dim myPage As PageWindow
Set myPage = ActivePageWindow

'Make sure we're in Normal view
myPage.ViewMode = fpPageViewNormal

'Remove the meta tag
ActiveDocument.all.tags("meta").Item("GENERATOR").outerHTML = ""

'Save and close the page.
myPage.save
myPage.Close

End If

Next myFile

'Now we have to recursively call the RemoveMetaTag procedure so
'that we can loop through all folders in the web.
Dim mySubFolder As WebFolder

For Each mySubFolder In myWebFolder.Folders

'Only call RemoveMetaTag if the current subfolder is not a subweb
If mySubFolder.IsWeb = False Then RemoveMetaTag mySubFolder

Next mySubFolder

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top