word 2007 document body has [ ] andstrange text background

M

markqu

On the screen, the entire document body is enclosed between two square
brackets [ ] and the text background is colored i.e. not white.

The background color of the text does not print (good thing) but the [ ] do
print and that wrecks the printed copy.

Seems to be some kind of document attribute becasue if I create a new doc, I
dont see the same problem. It is undesirable and I want to turn it off!
 
J

Jay Freedman

On the screen, the entire document body is enclosed between two square
brackets [ ] and the text background is colored i.e. not white.

The background color of the text does not print (good thing) but the [ ] do
print and that wrecks the printed copy.

Seems to be some kind of document attribute becasue if I create a new doc, I
dont see the same problem. It is undesirable and I want to turn it off!

It sounds like you've somehow gotten the entire document inside a text form
field--although the brackets at the ends of the field shouldn't print.

Make a copy of the problem document and run this macro while the cursor is in
that copy (not in the original!) -- see
http://www.gmayor.com/installing_macro.htm if needed.

Sub x()
Dim oRg As Range
With ActiveDocument
If .Fields.Count = 1 Then
.Range.InsertAfter vbCr
Set oRg = .Range
oRg.Collapse wdCollapseEnd
oRg.Text = .Fields(1).Result
.Fields(1).Delete
End If
End With
End Sub

If I'm correct, that will fix it by copying the field's contents outside the
field and then deleting the field. (If it is a text field, you can't select its
contents without also selecting the field itself, so this kind of fix won't work
without a macro.)
 
M

markq

Nope. Good idea but it didn't work. I stepped through the macro and the
..Fields.Count for the active document returns 0. The code to delete the
fields doesn't execute.

That probably explains why the [ ] brackets are printing (because they are
not text field boundaries)

Any other ideas?

Jay Freedman said:
On the screen, the entire document body is enclosed between two square
brackets [ ] and the text background is colored i.e. not white.

The background color of the text does not print (good thing) but the [ ] do
print and that wrecks the printed copy.

Seems to be some kind of document attribute becasue if I create a new doc, I
dont see the same problem. It is undesirable and I want to turn it off!

It sounds like you've somehow gotten the entire document inside a text form
field--although the brackets at the ends of the field shouldn't print.

Make a copy of the problem document and run this macro while the cursor is in
that copy (not in the original!) -- see
http://www.gmayor.com/installing_macro.htm if needed.

Sub x()
Dim oRg As Range
With ActiveDocument
If .Fields.Count = 1 Then
.Range.InsertAfter vbCr
Set oRg = .Range
oRg.Collapse wdCollapseEnd
oRg.Text = .Fields(1).Result
.Fields(1).Delete
End If
End With
End Sub

If I'm correct, that will fix it by copying the field's contents outside the
field and then deleting the field. (If it is a text field, you can't select its
contents without also selecting the field itself, so this kind of fix won't work
without a macro.)

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
 

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