Return to the Systems Tips
Copying 5250 screens into Microsoft Word
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.
Word 97 Version, version modified for Word 2002 is below this version.
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 .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 .SpaceAfter = 0 .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = True .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = True .FirstLineIndent = CentimetersToPoints(0) .OutlineLevel = wdOutlineLevelBodyText End With Selection.Paste Selection.MoveDown Unit:=wdLine, Count:=2 End Sub Word 2002 version as modified by David Tyndall Used the macro for pasting screens into Word in Word 2002 and I made the following changes in order to not have any errors (see .ColorIndex attribute wdAuto): Sub ScreenShot() Selection.TypeParagraph Selection.TypeParagraph Selection.MoveUp Unit:=wdLine, Count:=2 With Selection.ParagraphFormat With .Borders(wdBorderLeft) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .ColorIndex = wdAuto End With With .Borders(wdBorderRight) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .ColorIndex = wdAuto End With With .Borders(wdBorderTop) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .ColorIndex = wdAuto End With With .Borders(wdBorderBottom) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .ColorIndex = wdAuto 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 = wdAuto End With With Selection.Font .Name = "Courier New" .Size = 8 .Bold = False .Italic = False .Underline = wdUnderlineNone .UnderlineColor = wdAuto .StrikeThrough = False .DoubleStrikeThrough = False .Outline = False .Emboss = False .Shadow = False .Hidden = False .SmallCaps = False .AllCaps = False .ColorIndex = wdAuto .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 SubThanks to Lastric Igor for the above Word macro
[report a broken link by clicking here]