problem with a recorded macro

M

madhg

I've recorded a macro in Word 2000. It takes a column of addresses,
fiddles with the newline and paragraph characters, then converts to a
2-column table. It appears to work OK, the table looks good. But it
refuses to print out.

When I use Print Preview, I see a single blank page, with no table in
sight. When I return to normal view, my table reappears, but with a
blank page put in front of it. Weird.

If I go through the convert-to-table process manually, there are no
problems.

I have no idea what is going on. I don't know VBA (though I have
tinkered a bit in the dim distant past) - but presumably the "record
macro" function is designed for people like me.

Any ideas would be much appreciated.

David
----------------------------------------------------------------------------------------------------------
Here's the code copied from the VBA editor.

Sub Macro9()
'
' Macro9 Macro
' Macro recorded 04/03/2008 by David
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p"
.Replacement.Text = "^l"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^l^l"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
Selection.ConvertToTable Separator:=wdSeparateByParagraphs,
NumColumns:=2, _
NumRows:=32, InitialColumnWidth:=CentimetersToPoints(10),
Format:= _
wdTableFormatNone, ApplyBorders:=True, ApplyShading:=True,
ApplyFont:= _
True, ApplyColor:=True, ApplyHeadingRows:=True,
ApplyLastRow:=False, _
ApplyFirstColumn:=True, ApplyLastColumn:=False, AutoFit:=True,
_
AutoFitBehavior:=wdAutoFitFixed
Selection.Tables(1).Select
With Selection.Tables(1)
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
.Borders(wdBorderTop).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
.Borders(wdBorderVertical).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleDot
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorAutomatic
End With
Selection.Tables(1).Select
With Selection.Cells(1)
.TopPadding = CentimetersToPoints(0.03)
.BottomPadding = CentimetersToPoints(0.03)
.LeftPadding = CentimetersToPoints(1)
.RightPadding = CentimetersToPoints(0.3)
.WordWrap = False
.FitText = True
End With
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.Tables(1).Rows.Alignment = wdAlignRowCenter
Selection.Tables(1).Rows.LeftIndent = CentimetersToPoints(0)
Selection.Rows.HeightRule = wdRowHeightExactly
Selection.Rows.Height = CentimetersToPoints(3.81)
Selection.Rows.AllowBreakAcrossPages = False
End Sub
 
M

macropod

Hi madhg,

Have you checked to ensure the font in use isn't formatted as hidden text?

Cheers
 

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