Tuesday, January 23, 2007

Frames

Word does not provide a frame-management facility. Frames were orphaned with the release of Word97.

Legacy documents and legacy habits continue to provoke problems with frames.

These procedures attempt to reduce the frustration associated with frames.

As a minimum, we wish that Word’s Edit-Replace dialogue provided an option to replace frames in the sense that we can replace section breaks and other non-text items.

We will provide ability to locate and select the next frame, to clear all frames, to count the frames in a document.

Replacement of a frame prompts us to ask what makes sense as a replacement?

The procedures supplied allow the developer to:

  1. Count frames within a range
  2. Select the first frame in a range (GoTo)
  3. Select the last frame in a range (GoTo)
  4. Move forward one frame
  5. Move backward one frame
  6. Delete all frames within a range (except those frames that lie within tables).

These procedures could form the basis of a GUI form similar to Word's Edit, Replace.

Public Function DeleteFrames(rng As Range)

Public Function lngCountFrames(rng As Range) As Long

Public Function SelectBackwardFrame(ByVal rng As Range)

Public Function SelectFirstFrame(rng As Range)

Public Function SelectForwardFrame(ByVal rng As Range)

Public Function SelectLastFrame(rng As Range)

Here is a crude attempt to circumvent the frame/table problem:

Public Function DeleteFrames(rng As Range)
Dim lng As Long
For lng = rng.Frames.Count To 1 Step -1
If rng.Frames(lng).Range.Information(wdWithInTable) Then
' MsgBox "I cannot delete frames within tables"
Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:=True
rng.Frames(lng).Delete
Selection.ConvertToTable Separator:=wdSeparateByTabs, Format:=wdTableFormatNone
Else
rng.Frames(lng).Delete
End If
Next lng
End Function
Sub TESTDeleteFrames()
Call DeleteFrames(Selection.Range)
End Sub

Tuesday, January 09, 2007

New release

I have uploaded UW350.dot.
You can download it from my downloads page at http://www.chrisgreaves.com/Downloads/