Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2008

Tip: Looking for answers? Try searching our database.

problem with a recorded macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
madhg - 04 Mar 2008 18:48 GMT
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
macropod - 05 Mar 2008 22:53 GMT
Hi madhg,

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

Cheers
Signature

macropod
[MVP - Microsoft Word]
-------------------------

> 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
[quoted text clipped - 97 lines]
>    Selection.Rows.AllowBreakAcrossPages = False
> End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.