Format 5250 screens into Microsoft Word

Word macro that automatically formats the 5250 text and adds a border around the 5250 "screen" in Word.

It is yet another method -- a slick Word macro that automatically formats the 5250 text and adds a border around...

the 5250 "screen" in Word.

To use the ScreenShot macro, first display the 5250 screen, click and drag the cursor over the text you want to copy (or alternately, select all text), then press Ctrl-C or Shift-Insert to copy the text to the clipboard. In Word, simply run the ScreenShot macro. The macro formats the text and pastes it into the Word document.

I commented out some of the lines below to make this macro work with Word 97; you can uncomment the lines for Word 2000.


 
  
    Sub ScreenShot()
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.MoveUp Unit:=wdLine, Count:=2
    With Selection.ParagraphFormat
        With .Borders(wdBorderLeft)
            .LineStyle = wdLineStyleSingle
            .LineWidth = wdLineWidth050pt
            .ColorIndex = wdColorAutomatic
        End With
        With .Borders(wdBorderRight)
            .LineStyle = wdLineStyleSingle
            .LineWidth = wdLineWidth050pt
            .ColorIndex = wdColorAutomatic
        End With
        With .Borders(wdBorderTop)
            .LineStyle = wdLineStyleSingle
            .LineWidth = wdLineWidth050pt
            .ColorIndex = wdColorAutomatic
        End With
        With .Borders(wdBorderBottom)
            .LineStyle = wdLineStyleSingle
            .LineWidth = wdLineWidth050pt
            .ColorIndex = wdColorAutomatic
        End With
        With .Borders
            .DistanceFromTop = 1
            .DistanceFromLeft = 4
            .DistanceFromBottom = 1
            .DistanceFromRight = 5
            .Shadow = True
        End With
    End With
    With Options
        .DefaultBorderLineStyle = wdLineStyleSingle
        .DefaultBorderLineWidth = wdLineWidth050pt
        .DefaultBorderColorIndex = wdColorAutomatic
    End With
    With Selection.Font
        .Name = "Courier New"
        .Size = 8
        .Bold = False
        .Italic = False
        .Underline = wdUnderlineNone
        '.UnderlineColor = wdColorAutomatic
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdColorAutomatic
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Spacing = 0
        .Scaling = 100
        .Position = 0
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With Selection.ParagraphFormat
        .LeftIndent = CentimetersToPoints(1)
        .RightIndent = CentimetersToPoints(0.7)
        .SpaceBefore = 0
        '.SpaceBeforeAuto = False
        .SpaceAfter = 0
        '.SpaceAfterAuto = False
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphLeft
        .WidowControl = True
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
        '.CharacterUnitLeftIndent = 0
        '.CharacterUnitRightIndent = 0
        '.CharacterUnitFirstLineIndent = 0
        '.LineUnitBefore = 0
        '.LineUnitAfter = 0
    End With
    Selection.Paste
    Selection.MoveDown Unit:=wdLine, Count:=2
End Sub

 

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

This was last published in April 2003

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close