elf logo byUsers logo
Search the site: 
 
FAQs

Lower case Issues for Frontpage Users

A way to repair Upper Case > lower case issue for FP users

For those of us who are using MS FrontPage 2000/2002, and who have been affected by the new UNIX server transfer, here is a way to fix the Upper Case problem, which causes page hyperlinks and images links to be broken. The following macro will convert all upper case pages, links and images within your web to lowercase therefore correcting any broken pages, links or images.

Follow these instructions:

SETTING UP THE MACRO

  1. Open FrontPage 2000/2002.

  2. Open the Visual Basic Editor. (To do this, go to TOOLS > MACRO > VISUAL BASIC EDITOR)

  3. Add a new module. (To do this, right-click "Microsoft_Frontpage" in the PROJECT window, point to INSERT and then click MODULE)

  4. Paste the following Visual Basic code into the new module:

    Option Explicit
    Const strValid = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    Const intTempNameLength = 16



    Sub ToLowerCase()
      On Error Resume Next
      Dim objWebFile As WebFile
      Dim objWebFolder As WebFolder
      Dim objSubFolder As WebFolder
      Dim strBaseFolder As String
      Dim lngFolderCount As Long
      Dim lngBaseCount As Long
      With Application
        If .ActiveWebWindow.Caption = "Microsoft FrontPage" Then
          MsgBox "Please open a Web before you run this function.", vbCritical
          Exit Sub
        ElseIf .ActiveWeb.ActiveWebWindow.PageWindows.Count <> 0 Then
          MsgBox "Please close all files before running this macro.", vbCritical
          Exit Sub
        End If
        .ActiveWeb.ActiveWebWindow.ViewMode = fpWebViewFolders
        .ActiveWeb.Refresh
        .ActiveWeb.RecalcHyperlinks
        lngFolderCount = 1
        lngBaseCount = 0
        ReDim strFolders(1) As Variant
        strBaseFolder = .ActiveWeb.RootFolder.Url
        strFolders(1) = strBaseFolder
        While lngFolderCount <> lngBaseCount
          Set objWebFolder = .ActiveWeb.LocateFolder(strBaseFolder)
          For Each objSubFolder In objWebFolder.Folders
            If objSubFolder.IsWeb = False Then
              lngFolderCount = lngFolderCount + 1
              ReDim Preserve strFolders(lngFolderCount)
              RenameFolderToLowerCase objSubFolder, True
              strFolders(lngFolderCount) = objSubFolder.Url
            End If
          Next
          lngBaseCount = lngBaseCount + 1
          strBaseFolder = strFolders(lngBaseCount + 1)
        Wend
        For lngBaseCount = 1 To lngFolderCount
          Set objWebFolder = .ActiveWeb.LocateFolder(strFolders(lngBaseCount))
          For Each objWebFile In objWebFolder.Files
            RenameFileToLowerCase objWebFile, True
          Next
        Next
        .ActiveWeb.RecalcHyperlinks
        .ActiveWeb.Refresh
      End With
      MsgBox "Conversion to lower case is complete.", vbInformation
    End Sub



    Function CreateTempName(intLength As Integer) As String
      On Error Resume Next

      Randomize Timer
      Dim intCount As Integer
      Dim strTemp  As String
      For intCount = 1 To intLength
        strTemp = strTemp & Mid(strValid, Int(Rnd(1) * Len(strValid)) + 1, 1)
      Next
      CreateTempName = strTemp & ".tmp"



    End Function



    Sub RenameFileToLowerCase(objFile As WebFile, boolIgnoreHidden As Boolean)
      On Error Resume Next
      Dim strOldName As String
      Dim strNewName As String
      strOldName = objFile.Name
      If boolIgnoreHidden Then
        If Left(strOldName, 1) = "_" Then Exit Sub
      End If
      If strOldName <> LCase(strOldName) Then
        strNewName = CreateTempName(intTempNameLength)
        Call objFile.Move(LCase(strNewName), True, True)
        Call objFile.Move(LCase(strOldName), True, True)
      End If



    End Sub



    Sub RenameFolderToLowerCase(objFolder As WebFolder, boolIgnoreHidden As Boolean)
      On Error Resume Next
      Dim strOldName As String
      Dim strNewName As String
      Dim strTmpPath As String
      strOldName = objFolder.Name
      If boolIgnoreHidden Then
        If Left(strOldName, 1) = "_" Then Exit Sub
      End If
      If strOldName <> LCase(strOldName) Then
        strNewName = CreateTempName(intTempNameLength)
        strTmpPath = Mid(objFolder.Url, Len(objFolder.Web.RootFolder.Url) + 2)
        strTmpPath = Left(strTmpPath, Len(strTmpPath) - Len(strOldName))
        Call objFolder.Move(strTmpPath & LCase(strNewName), True, True)
        Call objFolder.Move(strTmpPath & LCase(strOldName), True, True)
      End If



    End Sub

  5. Click on the FILE menu and click SAVE or SAVE MICROSOFT_FRONTPAGE (whichever is available)

  6. Click on the FILE menu again and click CLOSE AND RETURN TO MICROSOFT FRONTPAGE

EXECUTING THE MACRO.

  1. Open your Web in FrontPage.
    Do File/Close (otherwise you will get the message 'Please close all files before running this macro'

  2. On the TOOLS menu, point to MACRO and then MACROS

  3. In the MACRO NAME box, select "ToLowerCase", then click RUN

  4. When the conversion is finished, FrontPage displays a message box informing you that the "Conversion to lover case is complete"

Let me know how everyone gets on with it.

Last Amended : 2003-03-31 by Derek
Original Author : David Cash dc@dnet.co.uk

This page was last updated at