Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 4 Mar 2008 10:48:08 -0800 (PST),    group: microsoft.public.word.vba.beginners        back       


problem with a recorded macro   
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
date: Tue, 4 Mar 2008 10:48:08 -0800 (PST)   author:   madhg

Re: problem with a recorded macro   
Hi madhg,

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

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

"madhg"  wrote in message news:8ffd0634-11d9-4107-abb8-07885a73a186@q33g2000hsh.googlegroups.com...
> 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
date: Thu, 6 Mar 2008 09:53:52 +1100   author:   macropod lid

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us