Sie sind auf Seite 1von 10

How to create a macro in Word for screen-prints and report layout

There are 2 ways to go to create macro in Word:


1. Go to Tools/Macro/Macros
2. Press ALT + F8

The following pop-up window will be displayed.


1. Fill out the Macro name field with the selected name
2. Press the Create bottom

1
Document created by:
Heber Rodrguez

How to create a macro in Word for screen-prints and report layout


Once you press the create bottom, Word will open a Visual Basic program:
1. Delete the text from the document

Delete all the text from


the document

2. Copy the following script


3. Save and close the file
Sub ReportShot()
Selection.TypeParagraph
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=2
With ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = InchesToPoints(1)
.BottomMargin = InchesToPoints(1)
.LeftMargin = InchesToPoints(1)
.RightMargin = InchesToPoints(1)
.Gutter = InchesToPoints(0)
.HeaderDistance = InchesToPoints(0.5)
.FooterDistance = InchesToPoints(0.5)
.PageWidth = InchesToPoints(8.5)
.PageHeight = InchesToPoints(11)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False

2
Document created by:
Heber Rodrguez

How to create a macro in Word for screen-prints and report layout


.GutterPos = wdGutterPosLeft
End With
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 = 6
.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

3
Document created by:
Heber Rodrguez

How to create a macro in Word for screen-prints and report layout


.Subscript = False
.Spacing = 0
.Scaling = 100
.Position = 0
.Kerning = 0
.Animation = wdAnimationNone
End With
With Selection.ParagraphFormat
.LeftIndent = CentimetersToPoints(0.2)
.RightIndent = CentimetersToPoints(-0.4)
.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
Sub ScreenShot()
Selection.TypeParagraph
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=2
With Selection.ParagraphFormat
With Options
.DefaultBorderLineStyle = wdLineStyleEngrave3D
.DefaultBorderLineWidth = wdLineWidth150pt
.DefaultBorderColor = wdColorBlue
End With
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
'.ColorIndex = wdColorAutomatic
End With
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
'.ColorIndex = wdColorAutomatic
End With

4
Document created by:
Heber Rodrguez

How to create a macro in Word for screen-prints and report layout


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 = InchesToPoints(0.3)
.RightIndent = InchesToPoints(0.4)
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 0

5
Document created by:
Heber Rodrguez

How to create a macro in Word for screen-prints and report layout


.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

Go back to the Word document and do one of the following steps:


1. Go to Tools/Macro/Macros
2. Press ALT + F8
Now you will have the macros created.

6
Document created by:
Heber Rodrguez

How to create a macro in Word for screen-prints and report layout

How to assign an icon for each macro to run it directly:


1. Go to Tools/Customize

Select Commands Tab


Scroll down from the Categories and look for Macros

7
Document created by:
Heber Rodrguez

How to create a macro in Word for screen-prints and report layout


Draw from the Commands window to your main menu bar

To assign a new bottom image:


1. DO NOT close the Customize window
2. Right click on each default icon
3. Select Change Button Image and choose the one you like.

8
Document created by:
Heber Rodrguez

How to create a macro in Word for screen-prints and report layout


By default Word assign a name for the created macros. To change that name:
1. DO NOT close the Customize Window
2. Right click on each new bottom
3. Place on the Name Field and edit the text as you want.
For example:
Word Default Name
Normal.NewMacros.ReportShot
Normal.NewMacros.ScreenShot

User Desired Name


Report
Screen

9
Document created by:
Heber Rodrguez

How to create a macro in Word for screen-prints and report layout

Now the new macros with new icons will look like:

The screen shot will look like:


CBS

Comprehensive Banking System


Bank:
001
Library: LACSUPCR

Select one of the following:


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Common Subsystem
POD Subsystem
Transaction Subsystem
Time Subsystem
General Ledger Subsystem
Loan Subsystem
Anytime Teller Machine
External Application 2
Branch Subsystem
External Application 3
External Application 4
Process Server

13. CIF Subsystem

Bottom
Selection or function
===>
F3=Exit
F11=Change password
F13=Function requests
F14=Submitted jobs
Function 000010 ended normally.

F12=Cancel
F18=Spooled output

And the report will look like:


30-07-2002

CBS INTERNATIONAL BANK

TRANSACTION SYSTEM
CURRENCY CODE 000 HONG KONG DOLLARS
GL-ACCOUNT
COST BR-TYP TYPE NAME
000000000001000 20001 001-091 rosa's test
000000000001000 20001 001-092 rosa's test
000000000001000 20001 001-093 rosa's test
000000000001000 20001 001-900 ENTERPRISE ACC
COST CNTR TOTAL
ACCOUNT TOTAL
000000000002000 20001 001-900 ENTERPRISE ACC
000000000002000 20001 001-900 ENTERPRISE ACC
COST CNTR TOTAL
ACCOUNT TOTAL
000000000006000 20001 001-092 rosa's test
000000000006000 20001 001-093 rosa's test
COST CNTR TOTAL
ACCOUNT TOTAL
F3=Exit

F12=Cancel

F19=Left

F20=Right

LEDGER BALANCE VERIFICATION


CURR
CURR
CURR
ACAA
ADV
ACAL
ODA
ODA

TYPE BALANCE G/L ACCT TITLE


2137720.10 MISSING G/L ACCOUNT
84641.52
184424.19
1038.74
2407824.55
2407824.55
1038.74
1038.74.00
.00
129072.30 MISSING G/L ACCOUNT
235119.99
364192.29
364192.29

PROCESS THRU 30-07-2002


3-04-06

10:43:45

PAGE
TA0825
20-825

G/L BALANCE
.00

DIFFERENCE

.00
.00

2407824.55
2407824.55

.00
.00
.00

.00
.00

.00
.00

364192.29
364192.29
More...

F24=More keys

10
Document created by:
Heber Rodrguez

Das könnte Ihnen auch gefallen